Skip to main content

Git

Easy Git log

git log --oneline

Or add a Git alias in ~/.gitconfig to use git lg:

[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset %an -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative

Go back 3 commits

git reset --hard HEAD~3

Squash commits

Open an interactive shell where you can squash the commits before commit 759945155af

git rebase -i 759945155af 

Rebase

Useful when you want to merge master but want to avoid a merge commit on your experiment branch. More info here.

$ git checkout experiment
$ git rebase master

Force push

You can use + on the branch name

git push origin +branchName