Git Cheatsheet

Checkout

git checkout <branch-name>

Create Branch

git checkout -b <branch-name>
git push origin <branch-name> --set-upstream

List all branches

git branch --list

Fetching from remote

git fetch origin
git checkout --track <origin/branch-name>

List merged branches

git branch -a --merged

Delete remote branch

git push origin --delete <branch-name>

Undo Changes

Reset current changes

git reset --hard

Undo commit

git reset --hard <commit-id>