Jens A. Koch

Git workflows compared | “github flow” in comparison to “git flow”

The question “How to work successfully with Git” is not easily answered. In general one might say that a complex tool provides and supports complex working methodologies. That’s clearly the case when talking about Git. When working gets complex and cumbersome and you find yourself lost in the Git jungle, then it’s time to structure your workflow. This article is about two workflows for Git. A general workflow named “git flow” and a platform specific workflow named “github flow”.

One of the most important features of Git are “branches”. Working with branches in an organized manner is key to working successfully and more productively with Git. Vincent Driessen’s high-impact article A successful Git branching model was the first to describe a workflow focused on “Git branches”. His workflow is named “git flow”.

The following video is a short introduction into working with “git flow”.

A more platform specific way of working with Git is described in an article by Scott Chacon. He focuses on working and managing code in branches when working with Github. For “Github Flow” in comparison to “Git Flow” you may read his article.

Or simply skip reading it and start using the aliases provided below.
The following section is an “Alias” breakdown for the Github Workflow.
You might add them to your “.gitconfig”.
Most of these aliases are self explanatory.
For a couple exceptions you’ll find a legend with usage hints below.

[alias]
c = commit -am
a = add -A
co = checkout
new = !sh -c 'git checkout master && git fetch origin && git merge --ff origin/master && git checkout -b $1 master && git push -u origin $1'
up = !git fetch origin && git rebase -p origin/master
ir = !git rebase -i origin/master
next = !git add -A && git rebase --continue
done = !git fetch origin && git rebase -p origin/master && git push
stage = !sh -c 'git checkout master && git merge --no-ff $1 && git fetch origin && git rebase -p origin/master && git push'
deploy = !sh -c 'git checkout master && echo $1 > tag && git tag -a $1 -m $2 && git fetch origin && git rebase -p origin/master && git push --tags origin master'
fix = 1sh -c 'git checkout -b $1 master && git fetch origin && git rebase -p origin/master'
fixed = !git fetch origin && git rebase -i origin/master && git push origin master
rmb = !sh -c 'git branch -D $1 && git push origin :$1' -
l = log --graph --pretty=format:'%Cblue%h%d%Creset %ar %Cgreen%an%Creset %s'

Legend

git new # will update master then create a new branch then push it to origin
git fix # will update master then create a new branch
git stage 
git deploy # "" eg: git deploy v1.0.3 "Release v1.0.3 - Release name: Funky Monkey"
git rmb # will removed a branch both locally and remotely when it is no longer needed
Tags: , , . Comments Off on Git workflows compared | “github flow” in comparison to “git flow”

Comments are closed.