git - How does one change a range of commits to have happened on another branch? -


My impression is that the solution is simple, but I can not find an example that clearly resolves my problem I do get guidance on the following:

I currently have a history:

  a - - - c - - - - - f master \ \ B - - - d - e - - - g - h topic  

d , e , g , And h must all be done on master . At this point only the difference should be B then it should look like:

a - - - c - d - e - f - g - h master b topic

or better yet:

  A - C - D - E - F - G - H Master \ b topic  

... but I do not know how to be completed

It does not seem that I have written D , e Can I merge into live , and . H all ends at I b with master .

I believe that I can raise them cherries, but it seems that to present future problems, what is the best solution?

If you are pushing these branches in any remote repo, this is not a good past history If you have pushed, then I would like to avoid writing again by doing this:

  1. Master 's F > Master
  2. Cherry-selected D , e , g and h .
  3. Merge with checkout subject and master .

If you do this, then you have: -> -> -> -> -> -> - - - - - - D '- E' - G ' - - - - - - - - - Topic -

History will not look super-clean, but you will have code for every code.


If you really want to re-write the history because it's just local for you or you do not care to mess with others who can pull from your repo: / P>

  1. Roll the master back to C (Note the hash before > F .).
  2. Cherry-pick D , e , F , g and HK on Master .
  3. Branch Topic2 to Master 's h head.
  4. The cherry-pick b at topic2 .
  5. Change the topic from topic , topic 2

And you get:

  A - C - D - E - F - G - H Master B topic  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -