DEV Community

Cover image for You need to know about Github CLI
Luiz Calaça
Luiz Calaça

Posted on

You need to know about Github CLI

Hi, Devs!

What is GitHub CLI: A Command Line Interface to handle easily: repo clones, pull requests, merges, issues, gists and much others

Documentation: https://cli.github.com/manual/

Installation

//Mac
brew install gh
//Linux
https://github.com/cli/cli/blob/trunk/docs/install_linux.md
Enter fullscreen mode Exit fullscreen mode

Are you going to clone a repo?

gh auth login
gh repo list
gh repo clone <repo_name_from_list>
Enter fullscreen mode Exit fullscreen mode

Yes, you don't need to go to the Github page, all in one CLI tool you could clone a project.

Creating, deleting and configuring a repository

gh repo create

gh repo create <name_of_repo> --public

gh repo create my-project --private --source=. --remote=upstream

gh repo edit --visibility <visibility-string>

gh repo sync

gh repo create --disable-issues=true --public

gh repo list

gh repo delete <name_of_repo>

gh repo clone <name_of_repo>

gh repo fork <name_of_repo>
Enter fullscreen mode Exit fullscreen mode

Locally, you create your project with git init, commit your files and after you should go to the gh repo create and would be created remotely the repo and locally configured with the remote origin:

mkdir project && cd project

git init

gh repo create 
Enter fullscreen mode Exit fullscreen mode

Usually, when you are programming you think should be possible to save a piece of code. You can use the Gist:

Creating a gist easily

touch index.js // after create content for it

gh gist create index.js --public

gh gist create -

gh gist edit <gist_id> 

gh gist list --public 

gh gist list --secret
Enter fullscreen mode Exit fullscreen mode

Handling issues

gh issue create

gh issue list

gh issue status

git issue close <#number_issue>

gh list -A "<name_issue>"
Enter fullscreen mode Exit fullscreen mode

Handling Pull requests

gh pr create 

gh pr checkout <name>

gh pr diff <#number_of_pr>

gh review -c -b "nice work"

gh pr close <#number_of_pr> -d

gh pr reopen <#number_of_pr>

gh pr status
Enter fullscreen mode Exit fullscreen mode

If you get started to use certainly you'll see that's so great tool.

Contacts
Email: luizcalaca@gmail.com
Instagram: https://www.instagram.com/luizcalaca
Linkedin: https://www.linkedin.com/in/luizcalaca/
Twitter: https://twitter.com/luizcalaca

Top comments (0)