git#
add foo#
git add -A # --all
add bar#
git add -u # --update
delete merged branch#
git branch -d <branch-name>
force-delete unmerged branch#
git branch -D <branch-name>
rename current branch#
git branch -m <new-branch-name>
create new branch and check it out#
git checkout -b <new-branch>
do cherrypick stuff#
git cherry-pick <commit>
commit with a message#
git commit -m "<message>"
commit foo#
git commit --amend
commit bar#
git commit --fixup
show all unstaged changes#
git diff
git diff <file>
list the files that differ between main and the current branch#
git diff main..HEAD --name-only
show some logs#
git log --graph --oneline --decorate
show all the logs#
git log --graph --oneline --decorate --all
force the working tree into the state of a given reference#
git reset --hard <ref>
revert the last remote commit#
git reset --hard HEAD^
git push -f
Resources#