----- Original Message ----- 
  From: Paul Smith 
  To: git-users@googlegroups.com 
  Sent: Monday, March 11, 2013 3:33 PM
  Subject: [git-users] Reset branch to master after merge


  I've been searching but I've not found anyone else asking about this.  In my 
workflow I tend to do a bunch of work on a topic branch, merge it to master, 
then do some other things and come back a few weeks later and pick it up again. 
 Obviously when I start working on it again I want to start with the current 
master HEAD, not with the content that existed on the branch prior to my merge 
to master: master now contains all the code from my topic branch, plus all the 
new code people have added, already merged and ready to go.


  Certainly I can merge again from master back to my topic branch, but this 
creates a new commit on my topic branch for the merge.  This seems unnecessary 
to me.  I believe I'd prefer to reset my branch to master after I merge it, so 
that when I merge from master it does a fast-forward, until I decide to start 
working and make changes on the branch.  Does this make sense?  How do other 
people handle this situation?  Do people just do the merge and accept the extra 
commit?  We have a number of developers making lots of changes and our git repo 
is REALLY complicated (I can rarely make any sense out of gitk etc. as there 
are so many branches all over the place).  This model seems to add to that 
confusion (for me).


  Or do people delete their topic branch after the merge and re-create it later?


  I've tried a "git reset --hard master" and that works for my local branch, 
but I've had trouble figuring out how to deal with the remote branches (I need 
to push my local branches to our main repo so it can undergo code review etc. 
before merging to master).

On the assumption that the branch is your private branch, you can always force 
push it to overwrite waht it had previously, once you have reset it to master. 

But in a public situation this results in real problems with everybody getting 
confused when they can do a nice fetch/pull.

I am now using the 'git fetch <remote>' then 'git reset --hard @{upstream}' 
when I want to transfer a rebased private branch between machines (Windows <-> 
Linux machines, via github) http://stackoverflow.com/a/15284176/717355 This 
works quite nicely for my personal workflow, but it's not nice in a shared 
environment.


  Thoughts about this situation are welcome;


  Cheers!

  -- 
  You received this message because you are subscribed to the Google Groups 
"Git for human beings" group.
  To unsubscribe from this group and stop receiving emails from it, send an 
email to git-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
   
   

  No virus found in this message.
  Checked by AVG - www.avg.com
  Version: 2013.0.2904 / Virus Database: 2641/6162 - Release Date: 03/10/13

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to