When Git first came out I was using ClearCase, CVS, and SVN in my day to day development. I thought Git was interesting because the Linux Kernel community embraced it and Linus Torvalds created it. Unfortunately I found It limited and frankly not seamless. Later I worked on the first release of Rational Team Concert which I preferred to Git which was still limited. Then something interesting happened. Git started to get good. In fact it was getting really good. So much so when I later moved to the Watson group in IBM we moved to Git.
It was just simple and easy. We simplified our development process to make the most of its simplicity. I put my head down. I stopped paying attention to Git. I just focused on developing software with what I knew. During that time Git didn’t stand still. It was improving.
I now feel like I am having a Git renascence. I am discovering that I can do things in Git. Earlier, I thought I needed extra tools for these tasks. For instance I thought I needed plugins in my IDE to work on multiple branches at the same time. As I have been slowly breaking my reliance on IDEs I found git worktree.
With Git’s worktree command lets you easily work on multiple branches at the same time. It does so via different directories. This avoids having to stash changes and current work is visible via the directory structure.
To get started
- Create a project directory
- Clone a bare repository
git clone --bare <repo url>. - Go to that new git directory
- Now you can add additional parent directories that represent a branch
git worktree add --track -b <branch> ../<branch> <remote>/<branch>
Now when you look at the parent project directory, you can work with multiple branches simultaneously. You do this by using the different sub-directories.
Git has come a long way. The more I explore the more I realize the less tools I need. Using less tools means I go faster.