comfy git

customising bash and gitconfig for fun and profit

Git is amazing but verbose. (The awkward length of its commands may well be a feature, since awkward things force us us think, and careful thinking kinda behooves nonlinear distributed development.)

We are trying to balance two forces: 1) every increase in typing ease means an increase in the risk of typo error. 2) Every ounce of effort that source control takes is subtracted from actual development.

The really terse aliases (one word, like "gits") require us to configure the bash shell rather than the git client running in it. First create a ".bashrc" file in your git bash current directory (i.e. in "~"):
touch ~/.bashrc
gedit ~/.bashrc
[Enter aliases you want, save]
source ~/.bashrc

For the git aliases just put em in here (starting with [alias] )
> gedit ~/.gitconfig

If you want to keep Git's excellent branch-name auto-complete working on your aliases, you'll need to add them in the .gitconfig as a separate word, hence my:
git ch
git br

I also have a setup script which updates the master branch and prunes deleted content. Run its name ('gup' or '. gitsetup.sh'), prepending a dot to break out of subshell context.

Scripts here.


Is this safe?

  • gup is safe because git checks if local changes would be overwritten before pulling.
  • del is safe because it's the soft delete version that can only delete fully merged things
  • The others are safe through the magic of bash functions.

No comments:

Post a Comment