git checkout <branch-name>
Example:
git checkout development
git checkout <branch-name>git pull <remote> <branch-name>
git checkout master
git pull upstream master
git diff <local branch> <remote>/<remote branch>
git fetch <remote> --tags
Example
git fetch upstream --tags
git tag <tag_name>
Example
git tag v1.2.0
git push origin --tags
git push origin <tag_name>
Example
git push origin v1.5
- git tag -d <tag_name>
Example
- git tag -d v2.5
git push <remote> :<tag_name>
Example
git push upstream :v2.5
git branch -u <remote>/<branch>
Example
git branch -u origin/my-branch
git checkout -b <branch-name> <remote>/<branch-name>
Example
git checkout -b other-branch origin/other-branch
If you want to track a remote branch add --track at the end of command
Example
git checkout -b other-branch origin/other-branch --track
git fetch <remote> <branch-name>
Example
git fetch origin developer
git fetch origin && git reset --hard origin/master && git clean -f -d
- First go to the base branch where you want to merge
git checkout <branch-base> - Now run the next command to merge
git merge <branch-to-merge>
git reset --soft HEAD~
git commit --amend
- checkout -> co
$ git config --global alias.co checkout
- branch -> br
$ git config --global alias.br branch
- commit -> ci
$ git config --global alias.ci commit
- status -> st
$ git config --global alias.st status
git branch -m <oldname> <newname>
Example
git branch -m mi-branch my-branch
git branch -m <newname>
Example
git branch -m my-new-branch-name
git branch -m <newname>
Example
git branch -m zonbie-branch
git branch -m <oldname> <newname>
Example
git branch -m zombi-branch zombie-branch