Git cheatsheet

Squash commits

(git log –­­pretty=oneline)
git rebase -­i HEAD~X (X = number of commits)

Rebase

git pull ­­–rebase (in master/<main_branch>)
git checkout <branch>
git rebase master (git rebase <main_branch>)

Rename branch (locally)

git branch ­-m <old_name> <new_name>

Create branch

git checkout ­-b <branch>

Commit

git commit -­m “message”

Push

git push origin <branch>

Delete branch (locally)

git branch ­-d <branch>

Create branch from branch

git checkout -b <new_branch> <old_branch>