//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
#delete tag on origin
$ git push --delete origin v1.2.1
#create branch
git checkout -b iss53
#to delete a local branch
git branch -d the_local_branch
#To remove a remote branch (if you know what you are doing!)
git push origin :the_remote_branch
# After the clone, you can list the tags with
$ git tag -l
# and then checkout a specific tag:
$ git checkout tags/<tag_name>
# Even better, checkout and create a branch (other you will be on a branch named after the revision number of tag):
$ git checkout tags/<tag_name> -b <tag_name>