This is probably a common scenario but there are so many Git workflow questions here on SO that I couldn't find an answer for my exact question. Which is:
I have a master
and future
branches in Git that live in parallel. future
contains some future features while master
is the current version (approximately).
When developing a future feature, I often encounter a situation where I need to make a fix that needs to go to master. What I do now:
- Stash work in progress in
future
- Switch to
master
- Fix code in
master
- Switch to
future
- Merge from
master
- Stash pop
In some cases, where the fix is better tested in the future
branch, the process becomes even more cumbersome, consisting of making the change in future
, committing it there, switching to master, cherry-picking from future, checking out future, reseting future and merging from master in the end.
There must be a better way but I can't figure it out. Approaches that wouldn't work (I believe; correct me if I'm wrong):
- Merging from
future
tomaster
. I don't want all commits from future in master. - Committing everything to
future
and then cherry-picking certain commits tomaster
. This alone would not be enough because future merges frommaster
tofuture
would cause duplicate commits (or maybe even conflicts?). Maybe I could create opposite commits infuture
to those cherry-picked tomaster
but that feels messy.
How do people deal with this workflow?