ACCEPTED]
I never make changes to a branch that is currently being reviewed. Messes things up when it needs amending.
Instead I branch off the commit that is under review. This way you can more easily rebase your latest changes onto merged commits in the master.
Might be there is a better way but this is how I deal with it and it works :-)
An example (I'm not sure I'm drawing everything the way git flows are supposed to be drawn but I think it will suffice.)
A--B--C (master)
\
D (issue_101)
Did some work and ready to push commit D so it can be reviewed. Now I don't want to wait for it to be reviewed before I continue my work so I branch off.
A--B--C (master)
\
D (issue_101)
\
E (issue_102)
Did some work in branch issue_102 (done with issue or not doesn't really matter here) and meanwhile commit D was approved. Checkout master and pull the change and it will look like this
A--B--C--D'(master)
\
D (issue_101)
\
E (issue_102)
Because the work for issue 101 is now in the master, we don't need branch with commit D anymore so we get rid of it git branch -D issue_101
A--B--C--D'(master)
\
D--E (issue_102)
Now we rebase issue_102 on master by doing
git checkout issue_102
git rebase -i master
In the screen that pops up, remove the pick for the old D branch. Remove the line entirely. We only want to rebase commit E on master after all.
After it's done it will look like this
A--B--C--D (master)
\
E (issue_102)
I find this an ideal way to work because should something be wrong with commit D and you need to make some changes, you can just stash your changes in branch issue 102 and checkout to issue 101 and amend whatever you want. After that you will have to rebase 102 on 101 so the amended changes are in 102 as well, though.
git rebase --onto master issue_101 issue_102is a better option if you want to merge _102 to master without the _101 commits. If _102 has dependencies from _101, usegit rebase -i issue_101from branch _102 to filter the important commits. - Narayon