Here is a short and simple list of some of the common git commands that I find myself using. This list will be continuously updated as needed.
- Pull all remote branches
- git fetch origin
- To see the branches available for checkout
- git branch -v -a
- Create a branch from existing remote
- git checkout -b NewBranchName origin/OldBranchName
- Create a branch from existing
- git checkout -b NewBranchName OldBranchName
- Push local branch to new remote branch with upstream tracking
- git push -u origin NewBranchName
- Push local branch to remote branch with upstream tracking and a new remote branch name
- git push -u origin local-name:remote-name
- Show uncommitted changes
- git status
- Show Local and Remote branches
- remote and local
- git branch -a
- remote only
- git branch -r
- local only
- git branch
- remote and local
- Save all local branch changes
- git add *
- Commit all saved changes with a message
- git commit -a -m “message”
- Pull from remote branch to local branch
- git pull origin BranchToPull
- Remove uncommitted local changes
- reset
- git reset –hard
- move back 1
- git reset –hard HEAD^
- move back N
- git reset –hard HEAD~N
- reset