The problems started when two other developers joined the team. Within a week we repeatedly had the issue of two people editing the same file at the same time and one of them losing their changes. So we devised our own source control system. Every file had a piece of cardboard with its name written on it, about 2cm by 10cm. These were stuck, with blu-tak, to a wall. If anyone wanted to edit a file they must stand up, go to the board, take the piece of cardboard for that particular file and stick it to their monitor. So we had an at a glance view of who was working on what and also made sure that the files were kept safe.
Since then I’ve used Visual Sourcesafe (don’t laugh). To my mind, it’s not completely awful, but I could never get my head around branching and merging. I then moved to Subversion which is both incredibly simple to use and free. And I understood branching and merging, but it was just a bit too long-winded to use.
However now I, like all the Rails-kids, use git. Which is both great and awful. It’s taken me weeks to even begin to get my head around it. I still lose code every now and then. But it’s so easy to branch and merge; for the first time, branching is an integral part of the way I work. There is danger in branching though. With svn it’s easy to see which branch you are in - it’s the folder name. In git, it’s not so easy.
So, my extremely smart colleague, David Smalley, showed me this amendment to your .bashrc (or in my case .profile):
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\u@\h:\w\$(parse_git_branch)\$ "
The function asks git which branch we are currently in. We then set PS1, the variable for the command prompt, asking it to show the username, host, path and branch.
So, if you are not in a git-managed folder you see:
rahoulb@monster:/Volumes/src$
And if you are in a git-managed folder you see:
rahoulb@monster:/Volumes/src/bb-billing(master)$
So now you have no excuse!
Photo by frko
