Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 1.07 KB

git.md

File metadata and controls

75 lines (52 loc) · 1.07 KB
title category description type
Git
Git
Git commands arround commits, stash, staging
personal

Commit

Only commit files in specific dir

git commit -m "Message" -- ./dir

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

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

Show commit content

git diff COMMIT^!

Staging

Diff staging

$ git diff --staged

Add new file as unstaged

$ git add -n

Warning: this is incompatible with stashing unstaged files somehow.

Stash

Stash unstaged & untracked

$ git stash -k -u

Stash unstaged files & untracked files (-u).

List branches

List branches that are ONLY local

git branch -vv | cut -c 3- | awk '$3 !~/\[/ { print $1 }'

Rebase