Commit
↔ snapshot of file/Code state, with UID SHA hash
aka Commits
Head
most recent Commit
Commit History
log of previous Commits
References
Commit History
↔ log of previous Commitsgit commit -m "init"
↔ to Commit with msg of initgit commit -am "_change"
↔ toadd
Working Dir & Commit with msg of _changegit reset _SHA
↔ toreset
to previous Commit with_SHA
UID in Mixed Moderevert
↔ to safely undo bad Commit via new Commit & keep Commit Historygit commit --amend _new
↔ to fix previous Commit with_new
namegit rebase master --interactive
↔ to controlrebase
Master Branch via interactive doc editor topick
&squash
Commitsgit commit --amend --no-edit
↔ to fix & update previous Commit with extra Staging file (aftergit add .
)bisect
↔ to walk through Commit History via Binary Search to find good/bad Commitsgit rebase -i --autosquash
↔ torebase
& autosquash
every CommitMixed Mode
↔ (default) behavior to move to prev Commit but NOT del filesundo to most recent [**_
Commit_**](commit) AND del [
Diff](diff)
↔git
reset --hardHEAD
git bisect start
↔ to startbisect
at last known working Commitgit bisect good
↔ to mark Commit as good & continuebisect
git bisect bad
↔ to mark Commit as bad & continuebisect
git reset HEAD~
↔ to undo last Commit & keep Diffgit reset --soft HEAD~1
↔ to undo Commit & keep Diff in Staging indexgit reset --soft HEAD
↔ to undo (& delete) last Commit & keep Diff. 💡 best to just click the undo last commit option in VSC Source Control Panelgit push --force origin __branch
↔ topush
local Commit toremote
Repo & FORCE sync to local (discardremote
history) 🔥 bad for teamwork!git push --force-with-lease origin __branch
↔ to push local Commit to remote Repo & SAFELY sync (avoid overwrite remote history) ✅ often mandatory to not get fired!Conflict
↔ when 2 Commits to Merge overwrite same file, git unsure which Branch to keep