Suppose I am working on some feature in a branch B. My feature depends on another feature that my colleague works on in a branch A.
I work closely with my colleague, so during development he will often update A with new stuff that I need in B. The way I get his changes in is to just merge with his branch. So what I do in B is something like the following:
git checkout master
git checkout -b B
..
git commit Some work
..
git commit More work
..
git fetch origin
git merge origin/A
..
git commit Event more work
..
git fetch origin
git merge origin/A
..
git commit And even more work
..
git fetch origin
git merge origin/A
...
This works very well. The problem is that we want to get this into master and to have a nice clean history. In particular we want to:
- Clean up the history of A using some kind of rebase
- Clean up the history of B using some kind of rebase
- Commit first A and then B to master without all the extra merges above.
The only way I can come up with to do this is to:
- Rebase A into master in the usual way
- Cherry pick all the non-merge commits from B onto master.
One problem with this is that I manually have to cherry pick the non-merge commits.
Is there a better way?