Friday, August 22, 2014

Git hints

Yesterday I went to the East Bay Ruby meetup to listen to a presentation titled "You don't know git". The presenter broke his presentation into three parts: git for a simple flow (one user), git for advanced simple flow, and git for a team work.

I apparently fall into an 'advanced single user' category, as I try using branches when I work on experimental features. However, git for team work is a very different story. It certainly requires some practice with a team.

Some of the useful tips I could incorporate now is to customize most commonly used git commands in git config --global. The presenter suggested the following (although each person devises their own custom system):

a       = add .
au      = add -u
st      = status
ci      = commit -v
co      = checkout
br      = branch
unstage = reset HEAD --
last    = log -l HEAD


It takes some time getting used to it but in the long run it's faster to type git a instead of git add .

Another suggestion is to create bash aliases in order to shorten the commands even more. Thus, command git checkout or git co can be aliased as gco. This is 114% and 50% difference in the number of letters in the former and the latter cases, accordingly.

No comments :

Post a Comment