- List all local branches:
git branch -a
- Remove local branch:
git branch -d $branchname
- Cleanup branches that are on your local as remote but aren't remote anymore:
git remote prune origin --dry-run
(remove --dry-run to do it for real)
- add specific lines of a file:
git add -i $FILENAME
- remove last commit (before push):
git reset --hard HEAD^
- amend previous commit and add file:
git commit --amend src/file.ts
- amend previous commit message:
git commit --amend
show file names only: git diff --stat
show difference between current and previous head commits git diff HEAD^ HEAD
on conflict keep mine: git checkout --ours filename.ex
show last 10 - leave them in cli histroy git log --pretty=oneline |head -n 10