Git
A cheatsheet by @nathan-appere|Refreshed over 1 year ago.Refresh|View source on Github

Undo last commit

Undo last commit

$ git reset --soft HEAD~1
$ git reset

Undo the last commit + unstage everything.

$ git stash; git reset --soft HEAD~1; git stash pop;

Stash changes + undo the last commit + re-add changes.

Empty commit

Empty commit

$ git commit --allow-empty -m "Trigger re-deploy"

Diff staging

Diff staging

$ git diff --staged

Add new file as unstaged

Add new file as unstaged

$ git add -n

Warning: this is incompatible with stashing unstaged files somehow.

Stash unstaged & untracked

Stash unstaged & untracked

$ git stash -k -u

Stash unstaged files & untracked files (-u).

List branches that are ONLY local

List branches that are ONLY local

git branch -vv | cut -c 3- | awk '$3 !~/\[/ { print $1 }'
  • https://coderwall.com/p/xzsr9g/rebasing-dependent-branches-with-git