Good git commands

  • by

create new branch:
git branch 'branch name'

merge another branch to your current branch:
git merge 'branch name'

switch to another branch:
git checkout 'branch name'

recover to last commit on the same branch:
git checkout -f

Connect and track to remote branch not on your local repo:
git branch -u upstream/'branch name'

If a new remote has not been fetched:
git fetch upstream

Abandon a branch without committing or merge:
git branch -D 'branch name'

Leave a Reply