Skip to content

Instantly share code, notes, and snippets.

@rurumimic
Last active June 16, 2022 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rurumimic/51dd9e1087faac553987e14c2910b7df to your computer and use it in GitHub Desktop.
Save rurumimic/51dd9e1087faac553987e14c2910b7df to your computer and use it in GitHub Desktop.
git
# github cli
brew install gh
gh auth login
# fork
gh repo fork <user>/<repo>
# remote
cd <repo>
git remote -v
# origin git@github.com:rurumimic/<repo>.git (fetch)
# origin git@github.com:rurumimic/<repo>.git (push)
# upstream git@github.com:<user>/<repo>.git (fetch)
# upstream git@github.com:<user>/<repo>.git (push)
# clone
## gh repo clone <my>/<repo>.git
# add upstream
## git remote add upstream https://github.com/<user>/<repo>.git
# new branch and checkout
# git branch -a
git checkout -b <branch>
## git branch <branch>
## git checkout <branch>
# commit
git commit -a -m 'made other changes'
## git add .
## git commit -m 'message'
# log
git log --oneline --decorate --graph --all
# push
# git push <remote> <branch>
git push origin <branch>
# push request
gh pr status
gh pr checkout <number>
gh pr create
# fetch upstream
git fetch upstream master
# pull upstream
git pull upstream <branch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment