git-config Settings You Want
Git comes with some fairly lkml-specific
configuration defaults. You should fix this. All of the items below can be set
either for your entire login account (git config --global) or for a specific
repository (git config).
Full documentation is under git help config, unless otherwise stated.
-
git config user.name 'Your Full Name'andgit config user.email 'your-email@example.com', obviously. -
git config push.default simple- the default behaviour (calledmatching) of an unqualifiedgit pushis to identify pairs of branches by name and push all matches from your local repository to the remote. Given that branches have explicit “upstream” configuration identifying which, if any, branch in which, if any, remote they're associated with, this is dumb. Thesimplemode pushes the current branch to its upstream remote, if and only if the local branch name and the remote branch name match and the local branch tracks the remote branch. Requires Git 1.8 or later; will be the default in Git 2.0. (For older versions of Git, useupstreaminstead, which does not require that branch names match.) -
git config merge.defaultToUpstream true- causes an unqualifiedgit mergeto merge the current branch's configured upstream branch, rather than being an error. (git rebasealways has this behaviour. Consistent!) You should still merge thoughtfully. -
git config rebase.autosquash true- causesgit rebase -ito parse magic comments created bygit commit --squash=some-hashandgit commit --fixup=some-hashand reorder the commit list before presenting it for further editing. See the descriptions of “squash” and “fixup” ingit help rebasefor details; autosquash makes amending commits other than the most recent easier and less error-prone. -
git config branch.autosetupmerge always- newly-created branches whose start point is a branch (git checkout master -b some-feature,git branch some-feature origin/develop, and so on) will be configured to have the start point branch as their upstream. By default (withtruerather thanalways) this only happens when the start point is a remote-tracking branch. -
git config rerere.enabled true- enable “reuse recorded resolution.” Thegit help rereredocs explain it pretty well, but the short version is that git can record how you resolve conflicts during a “test” merge and reuse the same approach when resolving the same conflict later, in a “real” merge.
For advanced users
A few things are nice when you're getting started, but become annoying when you no longer need them.
git config advice.detachedHead- if you already understand the difference between having a branch checked out and having a commit checked out, and already understand what “detatched head” means, the warning on everygit checkout ...some detatched thing...isn't helping anyone. This is also useful repositories used for deployment, where specific commits (from tags, for example) are regularly checked out.