11 December 2015

git-multitasking.png

Suppose you are working on a bug 1234 on release 5.0 and now you are assigned another task, say feature A, on this release. Should you clone another copy of the repository to start coding for feature A? No! All that you need to do is create a branch based on rel-2.5 and work on that "task branch". This approach works even if you are using "git + gerrit".

Let's assume that you've already commit code for bug 1234 on rel-2.5 locally, awaiting approval of code review. You can create the task branch for feature A this way:

git branch feature-A rel-2.5
git checkout feature-A

In fact, as illustrated in the above picture, this approach enables you to work on more than two tasks concurrently

If you are using gerrit as the code inspection tool, you submit code review as usual (i.e. git push origin HEAD:refs/for/rel-2.5) even if you are working on a task branch. This works because the target is explicitly specified (HEAD:refs/for/rel-2.5).



blog comments powered by Disqus