We have a development branch which is our master and a separate maintenance branch. I frequently have to cherry-pick commits from the master to the maintenance or vice-versa when I fix bugs. Normally I accomplish this by performing the following procedure...
- Commit on the master branch
- Push commit to remote
- Switch/Checkout to maintenance branch
- Cherry-pick the commit from step 1
- Build and make sure everything is still working as intended
- Push maintenance commit to remote
The problem that I have is because the branches have become significantly divergent I have to rebuild the entire project each time I switch which takes up to 10 minutes. This is expected, but I'd like to not have to do this since I'm frequently switching between branches. So to avoid this I created a second working directory so that I have a directory for each branch. The problem with this is that I can't cherry-pick the original master commit into the maintenance directory until I've pulled that commit into the master branch of the maintenance directory from the remote. When I do this of course, I have to completely rebuild.
Is there a way to pull the commits into the master branch of my maintenance directory without switching? Or, is there a better way of doing this entirely? We recently switched to Git from CVS, so I'm not that familiar with it.