This is a small set of notes I took looking over some best practices for git.

They should be A.C.I.D.

  • Atomic
  • Consistent
  • Incremental
  • Documented

Stashing un-indexed changes: git stash save --keep-index <name>

Popping the last stashed item: git stash pop

Structure should consist of a short summary (max 50 chars) and a longer description.

This client-side hook validates the commit message to make sure it is formatted correctly. It can be installed with wget --show-progress --quiet -0 .git/hooks/commit-msg then grant execution rights with chmod a+x .git/hooks/commit-msg.

For new features, we can add commits that leave the app in a consistent state with all tests passing. Example commit stages could be refactoring, failing test & ignoring, implementing the feature…

We can re-write history to make sure we leave a good trail of commits. We do this with an interactive rebase.

git rebase <branch> -i lets you rebase to a branch and re-write your history.

I like coding, philosophy, and coffee. 👋

I like coding, philosophy, and coffee. 👋