Min, here how my workflow is now irrespective of the fact that one can commit or not this works for me:
0. Rule 0, you never ever work on the branch that tracks a remote branch, i.e. on master or on api_refactoring for example. 1. Say I want to work on a branch x (can be master, can be api_refactoring), I create my own personal branch; git checkout x; git checkout -b mybranch 2. I work on my branch "mybranch", add commit, there may be 100 commits, does not matter. 3. Time to send it for review? git checkout master or git checkout x (remember x was your local branch that tracks a remote branch); git pull origin x; create a merge branch, a merge branch is basically a temporary branch where you would squash all your 100 commits from your "mybranch" to one commit: git checkout -b mysquashbranch 4. Time to squash all 100 commits to one commit: git merge --squash "mybranch" (you're on the mysquashbranch) 5. git format patch -o <dir> HEAD~1, email or post on review board 6. Goto 2. make changes as suggested by reviewer. If patch accepted, stop. Hope this helps. On 28-Nov-2012, at 5:55 PM, Min Chen <min.c...@citrix.com> wrote: > Hi there, > > I have been following instructions in > http://incubator.apache.org/cloudstack/develop/non-contributors.html to > create patch for API refactoring work I have been working on. The instruction > may work well for the ideal case where the patch is quickly approved by > review board, but here is my scenario that I am stuck at updating my patch: > 1. I have created a private branch with an up-to-date copy of remote branch > (api_refactoring) at time A, and done my work there, and created a patch > using "git format-patch master --stdout > ~/patch-name.patch', and uploaded > it to create a review request, this is perfectly fine. > 2. Reviewer reviewed it and provided some feedback that I need to address. > 3. Then I am working on addressing the feedback on my private branch and > done, need to update the patch for another review. > 4. Just at the same time, remote api_refactoring branch is synced with master > branch and bring in a lot of new commits that are missing in my private > branch created at time A when I started my api refactoring work. > 5. So I have to sync my private branch to pull in latest code from remote > api_refactoring and merge conflicts. > 6. After all these, what command should I use to create an updated patch for > review board? The documented command "git format-patch master --stdout > > ~/patch-name.patch" will generate a patch file with all those commits brought > in from master sync, and also uploading the generated patch to review board > will give out error. > > Really appreciate that somebody can provide a quick tip on this. I keep > running into such issues by working on a separate non-master branch. > > Thanks > -min