Improve your Git workflow

How to use Git proficiently, both for personal and collaborative projects.

By Alberto Granzotto, last edit on 4 Apr 2014 with 4 revisions in
Git can be really hard in the beginning. It takes months to really grok all the aspects of this version control system. But when you get it, you can improve your workflow both on personal projects and on collaborative work.

Git branching models

  • Gitflow is a set of best practices on how to use Git proficiently with your team. Best suited for projects with releases.

  • GitHub Flow is an alternative to the Gitflow branching model, best suited for continuous deployment. At GitHub, devs push code in production many times a day, with no concept of release.

Commit conventions

  • Preemptive commit comments. What about writing commit comments before starting to code? Arialdo Martini analyses this interesting technique, showing all the benefits of thinking before starting to code.

  • AngularJS commit conventions. And, if you are brave enough, you'll learn how to generate the CHANGELOG by script.

  • Linux kernel guidelines on how to submit patches. Maybe too articulated, but a good read to have new ideas.

  • Django committing guidelines for core and partial committers. Their practice is to write detailed commit messages in the past tense, not present tense.

  • Commit messages best practices by the great tpope, explains what makes a well formed commit message.

  • Present or past tense? The endless debate reaches a conclusion.

Tips and tricks

  • Github hack to speed up git push and git pull. Instead of opening an ssh connection for every network activity you start, setup a ssh master connection and feel the breeze.

  • Integration with Zsh. Install zsh-git-prompt to have a zsh prompt that displays information about the current git repository, in particular the branch name, difference with remote branch, number of files staged, changed, etc.

  • Must have Git aliases. A long collection of advanced examples to speed up your Git-fu.

  • Is git pull harmful? git pull may introduce inconsistencies and problems. If you don't want to replace it, at least learn why it can be dangerous.

209
Read More
comments powered by Disqus