A live document updated over time to collect various Git related links that I find useful.
My Own Documents
Third Party Documents
I just came across some useful Git tips on a net tuts+ article Git Tips From the Pros which includes:
- Staging your commits in hunks;
- Grabbing a file from another branch without changing branches;
- Ignoring changes in a tracked file;
- Zero-ing out a branches history; and
- Some very useful aliases.
I’ve been through the mill with a few of these and it’s a growing list of options. I should start by saying that I love GitHub and use it regularly for a large number of projects (including some of my own, some for my company and some for my customers). The only problem I have with GitHub is that I just haven’t made the jump to trust it with our proprietary code – the primary asset of the company. Particularly after a high profile security breech.
Now, nothing I’ve come across yet comes close to GitHub. But two we use daily have good matching features:
- Gitorious – whether they intended it or not, it’s a good clone of GitHub but always a little behind on features. It’s also a Ruby on Rails application and the documentation is getting far better. When we started, it was pretty… shite, to be honest. Installing and upgrading was a pain. They have addressed this with http://getgitorious.com/ which includes a virtual appliance for VirtualBox so you can be up and running in minutes.
- Atlassian Stash – if you’re a small team (<= 10 users) then this could be for you. Installation is pretty easy, it looks great, is very fast (over HTTP/S, but it’s inbuilt SSH client is extremely slow) and is very easy to use. Pull requests are also done really really well. It’s a full Java webapp so it does require some CPU and memory. For <= 10 users, my definite favorite. Thereafter though it gets expensive – e.g. for up to 25 users you’ll fork out $1,800 / annum. That’s not entirely unaffordable but if you’re using Stash, then you may also be using their other products such as Jira, Confluence, Bamboo, Fisheye and Crucible. Now that adds up to a hefty bill!
One’s I have not tested and so cannot speak authoritively on include:
- GitLab – Looks like a very interesting alternative.
- RhodeCode – they say it will “change the way you manage your code”.
- Gitolite – a quick look at the available information for this definitely puts it in the also ran category. There’s no polish or anything nice to entice one to even try it.
- Gitosis – in their own words: “Manage git repositories, provide access to them over SSH, with tight access control and not needing shell accounts”. The project appears dead.
I know, I know. The fourth Git post in a row…
But, in case you missed it or in case you’d like to try Git without installing any software, then checkout http://try.github.com/
Today [GitHub are] launching a unique and easy way, in the format of a Code School interactive course, for new Git and GitHub users to try both the tool and the service without a single bit of software installation.
If you know of a developer, designer, or other knowledge worker that would benefit from using Git but that hasn’t made the leap just yet, send them over to try.github.com when they have a spare 15 minutes.
In current projects, we tend to float between two branching models depending on the requirements of the customer / project and the planned deployment process.
This was previously known as A successful Git branching model with an extremely detailed overview and instructions here. It has since spawned a project to help make using this model easier – git-flow.
This is a great branching model for a team of people who work towards creating planned versioned deployments (whether it be time based such as every second Tuesday, or milestone based).
In essence, this model uses two main branches:
origin/master – the main branch where the source code of
HEAD always reflects aproduction-ready state.
origin/develop – where the source code of
HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the “integration branch”. This is where any automatic nightly builds are built from.
Then developers create supporting branches as part of their development process:
- feature branches – branched off
origin/develop for active development of a new feature / enhancement;
- hotfix branches – a branch off
origin/master to apply a critical fix to production code;
- release branches – short lived branches off
origin/develop which are used for final testing and patched before being merged to
The model works very well in practice and the above linked document is a excellent read on Git branching practices in general as well as git-flow in particular.
This is the model used at Github and discussed by Github developer Scott Chacon here.
This is suited for projects that deploy continuously rather than around the concept of releases and so it’s less constrained than git-flow. These are two very different models and Scott puts forth his arguments in favour of the Github model in his post linked above.
In essence, Github flow works as follows:
origin/master is always deployable. Always.
- Similarly to git-flow, new features are done in their own branch – but off of
origin/master in this case.
- Now, when you believe your new feature is complete, a merge request is opened so someone else can review and check your work. This is the QA process.
- Once someone else signs off, you merge back into
- This is now deployable and can and will be deployed at anytime.