Skip to main content

Commit ↔ snapshot of file/Code state, with UID SHA hash

aka Commits

most recent Commit

Commit History

log of previous Commits

References

  1. Head ↔ most recent Commit

  2. Git Repo ↔ collection of Commits for project Diff history

  3. Staging ↔ list of files/code to add to next Commit

  4. Commit History ↔ log of previous Commits

  5. commit ↔ to create new Commit with Diff added in Staging

  6. git commit -m "init" ↔ to Commit with msg of init

  7. git commit -am "_change" ↔ to add Working Dir & Commit with msg of _change

  8. diff ↔ to print Diff between Commits

  9. git reset _SHA ↔ to reset to previous Commit with _SHA UID in Mixed Mode

  10. revert ↔ to safely undo bad Commit via new Commit & keep Commit History

  11. --amend ↔ flag to change msg on last Commit

  12. git commit --amend _new ↔ to fix previous Commit with _new name

  13. stash ↔ to save Diff w/o Commit, to array list

  14. squash ↔ to combine multi Commits into single name Commit

  15. git rebase master --interactive ↔ to control rebase Master Branch via interactive doc editor to pick & squash Commits

  16. pick ↔ (default) to keep Commit

  17. git commit --amend --no-edit ↔ to fix & update previous Commit with extra Staging file (after git add .)

  18. bisect ↔ to walk through Commit History via Binary Search to find good/bad Commits

  19. git rebase -i --autosquash ↔ to rebase & auto squash every Commit

  20. Mixed Mode ↔ (default) behavior to move to prev Commit but NOT del files

  21. undo to most recent [**_Commit_**](commit) AND del [Diff](diff)git reset --hardHEAD

  22. git bisect start ↔ to start bisect at last known working Commit

  23. git bisect good ↔ to mark Commit as good & continue bisect

  24. git bisect bad ↔ to mark Commit as bad & continue bisect

  25. git reset HEAD~ ↔ to undo last Commit & keep Diff

  26. git reset --soft HEAD~1 ↔ to undo Commit & keep Diff in Staging index

  27. git reset --soft HEAD ↔ to undo (& delete) last Commit & keep Diff. 💡 best to just click the undo last commit option in VSC Source Control Panel

  28. git push --force origin __branch ↔ to push local Commit to remote Repo & FORCE sync to local (discard remote history) 🔥 bad for teamwork!

  29. 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!

  30. Conflict ↔ when 2 Commits to Merge overwrite same file, git unsure which Branch to keep