In playing around on scenarios in which I often find myself, I have
the following repo:

master       dev
|             |
v             v
A ---> B ---> C

In an ideal world, the commit path would have had parts of the "C"
commit split into several bugfix branches instead of directly
committing on dev, resulting in

master   dev    bugs/5
|         |        |
v         v        v
A ------> B ----> Ca ... (future work on bug #1234 here)
           -----> Cb ... (future work on bug #2345 here)

allowing for further dev on the bug-fixes until they're really ready
for merging back into dev.

I played around with amend/stash/rebase and eventually got the repo
looking how I wanted, but had a nagging feeling there was a better
work-flow. Transcript below if you want to play along at home.  Is
there a better way to do this?



mkdir g;cd g
git init
seq 10 > file.txt
git add file.txt; git commit -m "Initial"
git co -b dev
sed -i '3s/.*/& &/' file.txt
git commit -am "dev: changed line 3"
sed -i '5s/.*/& &/' file.txt
sed -i '7s/.*/& &/' file.txt
git commit -am "partial work on bugs 5 and 7"
git reset HEAD^ # whoops
git co -b bugs/5
git add -p file.txt # select stuff for bug 5
git commit -m "partial work on bug 5"
git stash
git co -b bugs/7 dev
git stash pop
git add -p file.txt # select stuff for bug 7
git commit -m "partial work on bug 7"

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to