Git and GitHub commands, explained plainly
The 50 git and GitHub CLI (gh) commands people use every day: what each one does, the options that matter, and examples you can copy.
No commands match.
Set up and clone
Save changes
Look at history
Branches and merging
- git branchList, create and delete branches
- git checkoutSwitch branches or restore files (older all-in-one)
- git cherry-pickCopy individual commits onto the current branch
- git mergeCombine another branch into the current one
- git rebaseReplay your commits on top of another base
- git switchMove to another branch
- git tagLabel a commit, such as a release
Share with remotes
Undo and tidy up
Pull requests and issues
- gh issue createOpen a new issue
- gh issue listList issues in a repository
- gh issue viewRead an issue in the terminal
- gh pr checkoutSwitch to the branch of a pull request
- gh pr checksShow the CI check results for a pull request
- gh pr createOpen a pull request from the current branch
- gh pr listList pull requests in a repository
- gh pr mergeMerge a pull request
- gh pr viewShow the details of a pull request
Repos, actions and releases
- gh apiCall the GitHub API directly
- gh browseOpen the repository, an issue or a file in your browser
- gh gist createShare a file or snippet as a GitHub gist
- gh release createPublish a release on GitHub
- gh repo cloneClone a GitHub repository by name
- gh repo createCreate a new repository on GitHub
- gh repo forkMake your own copy of someone else's repository
- gh repo viewShow a repository's description and README
- gh run listList recent GitHub Actions workflow runs
- gh workflow runTrigger a GitHub Actions workflow manually