-
-
Save kk3399/cdafa7952561d24f0f54 to your computer and use it in GitHub Desktop.
Gits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //locally tracked branches | |
| git branch -vv | |
| git branch -l | |
| //list all branches | |
| git branch -a | |
| //list remote branches | |
| git branch -r | |
| //to list remote branches with locally tracked ones | |
| git remote show origin | |
| //fetch remote branches to local | |
| git remote update | |
| git fetch | |
| //to rebase while git pull | |
| git pull --rebase | |
| //to rebase before git push | |
| git rebase -i @{u} | |
| (on “feature”) git merge master to make feature compatible with latest master | |
| (on “master”) git merge --no-ff feature to ship a feature | |
| However if “feature” contains only 1 commit, avoid the merge commit: (on “master”) git cherry-pick feature | |
| //to stash local changes | |
| git stash | |
| //to replay changes on a branch | |
| git pop | |
| //branches, tags in git log | |
| git log --oneline --decorate | |
| //word diff | |
| git diff --word-diff | |
| //short status | |
| git status -sb | |
| //for setting tracking | |
| git push -u origin master | |
| git checkout -t origin/feature | |
| //rebases "feature" to "master" and merges it in to master | |
| git checkout feature && git rebase @{-1} && git checkout @{-2} && git merge @{-1} | |
| //to see whats cherry picked | |
| git cherry -v master | |
| git config --global branch.autosetuprebase always | |
| git config --global push.default tracking | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment