<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 5, 2020 at 9:51 AM <<a href="mailto:dufault@hda.com">dufault@hda.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Nov 5, 2020, at 09:40 , <a href="mailto:Jan.Sommer@dlr.de" target="_blank">Jan.Sommer@dlr.de</a> wrote:<br>
> <br>
> Ok, I hope I understand everything correctly.<br>
> Still, best to make a local copy of your repository directory.<br>
<br>
I shall do that.<br>
<br>
> <br>
>> You can see that my master is ahead of origin/master, and my local branches<br>
>> that I'd like to clean up (e.g. mvme5500-final, atsam-fixes) also include those<br>
>> changes.<br>
>> <br>
>> I think I want to do something like:<br>
>> - Rename my local master branch to a branch name that is related to the<br>
>> changes I put in;<br>
> <br>
> # Create a new branch from your local master branch under a new name<br>
> $ git branch NewBranchName master<br>
> # Reset the local master branch to be in line with origin/master (your changes will still be in NewBranchName)<br>
> $ git checkout master<br>
> $ git reset --hard origin/master<br>
<br>
This sounds straight-forward.<br>
<br>
> <br>
>> - Drop the changes I made that on that branch in the other branches, e.g<br>
>> mvme5500-final, atsam-fixes etc so that those branches are now based on<br>
>> origin/master and only have the changes related to what I was working on.<br>
>> <br>
> <br>
> You might achieve that with a rebase in the respective branch, e.g. for mvme5500-final:<br>
> $ git checkout mvme5500-final<br>
> $ git rebase -i origin/master<br>
> This should open a terminal with all commits in this branch since origin/master with the oldest commit at the top.<br>
> Simply, delete the full lines of all the commits you don't want to keep in the branch, i.e. the one from your old master, save and close.<br>
> If you are lucky and no conflicts appear, you end up with a branch which is based on origin/master with only the commits you want.<br>
> <br>
> Another option would be to create a new branch based on origin master and cherry-pick the commits you want to keep from mvme5500-final using git cherry-pick.<br>
> $ git branch mvme5500-new mvme5500-final<br>
> $ git checkout mvme5500-new<br>
> # Cherry-pick a single commit<br>
> $ git cherry-pick <commit hash><br>
> # Cherry-pick a set of continuous commits<br>
> § git cherry-pick <first commit>~..<last commit> # make sure to have the "~" after the first hash<br>
> <br>
> That's what I could come up with so far.<br>
> <br>
<br>
I'll try your first suggestion "rebase in the respective branch".<br>
<br>
"mvme5500-final" has too many changes to submit in one chunk. Next I'll need to figure out the best way to split those up into manageable, reviewable pieces.<br></blockquote><div><br></div><div>Sometimes I merge and reorder patches using "git rebase -i master" as a starting point.</div><div><br></div><div>Then if it is bad enough, I do a format-patch and start another branch. Some patches I</div><div>apply with git am. Others I apply using patch and commit pieces. This helps you regroup</div><div>until you get coherent and discrete patches.</div><div><br></div><div>This works well if you have changes scattered across files. But if you have changes</div><div>to a single file for multiple purposes you want to submit as separate patches, I have</div><div>stooped to editing the diff file and using patch to apply it in pieces. </div><div><br></div><div>This sounds tedious but after you do it a few times, it will become second nature.</div><div>I try to be careful never to commit unrelated changes and then use rebase to </div><div>combine as needed before submitting. </div><div><br></div><div>As to your first problem, my procedure is to export the changes as patches, save</div><div>the git repo with the mess, reclone, make a working branch in the new clone, and</div><div>pick away. I'm scared of destroying work and the new clone makes me more </div><div>conformatable that I am not screwing up something with git magic.</div><div><br></div><div>--joel</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks.<br>
<br>
Peter<br>
-----------------<br>
Peter Dufault<br>
HD Associates, Inc. Software and System Engineering<br>
<br>
This email is delivered through the public internet using protocols subject to interception and tampering.<br>
<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a></blockquote></div></div>