Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think I can help you with this as I have previously needed to do something similar.</p> <p>The downside is my solution is going to require some history rewriting. If you have many collaborators this will be painful as everybody's history is going to change. There's not really any way around this that I know of, because even something as simple as adding a parent commit before your current root will change the commit msg or our old root, which changes its SHA, which affects that parent field of its child, which changes its SHA, and so on and so on.</p> <p>From looking at your repository on github, it looks like you only have a couple contributors so this isn't quite so hairy.</p> <p>I'm also assuming that the bag repository at <a href="https://github.com/MinIenM/BAG-Extract" rel="nofollow">https://github.com/MinIenM/BAG-Extract</a> has not progressed since you read it in, which from reading the date of your commits and the BAG-Extract commits I presume is the case.</p> <p>Since it sounds like your goal is just to give credit, a subtree merge is probably for you. </p> <p>We'll basically do the following:</p> <ol> <li>Read in BAG-Extract as a new branch. It will share no common history.</li> <li>Identify where in your history you brought in the bag subdirectory. We'll call this "bagin"</li> <li>Add a new merge commit that will have the last BAG-Extract commit and the commit from (2) as parents. It will be a subtree merge, so the idea is that the two parents differ only in that one is prefixed with a subtree (e.g. bag/)</li> <li>Rebase all of your post "bagin" history onto this merge object.</li> </ol> <p>Here's some code to do it. To be safe, I'd clone things to a fresh repository that you can throw away if things don't go as planned</p> <pre><code>git clone git@github.com:milovanderline/NLExtract git log -- bag #Identify the first commit where "bag" enters. It starts with 78575 git checkout 78575 -b bagin git remote add bag git@github.com:MinIenM/BAG-Extract git fetch bag git checkout bagin -b baginmerge git merge bag/master -s subtree #Create the new merge object. baginmerge now points to the merge object. bagin, which hasn't moved, now has two children, one is the merge object, the other is your old history. git rebase --onto baginmerge bagin master -p #Calculate the diffs from bagin to master, and replay them onto baginmerge. The -p flag tells rebase to preserve merges. </code></pre> <p>In fact, I've already forked your repository and done the steps above. In my repository at <a href="https://github.com/dankessler/NLExtract" rel="nofollow">https://github.com/dankessler/NLExtract</a> you'll find a new branch called rebased_master. Feel free to pull this in. Unfortunately, from looking at your network graph, people have forked off from your repo, and this will likely screw them up, but they should be able to rebase or cherry-pick from any future updates since the contents of your commits ought to be identical, just their SHA's have changed.</p> <p>If you check out <a href="http://help.github.com/subtree-merge/" rel="nofollow">http://help.github.com/subtree-merge/</a> the subtree merge strategy is <em>mostly</em> similar, in that this should enable you to pull in future development from BAG-Extract should you so desire.</p> <p>I can think of another strategy that would make it look as if the development of bag had originally happened as a subtree of <em>your</em> repository (but with proper author ID), but that's probably not what you're looking for. The upside of that is that utilities like git blame and stuff might work better, but it's significantly more complicated and requires <code>git filter-branch</code> which I usually hear should be avoided when possible. If you want to go that route, though, let me know and I'll explain in more detail.</p> <p>Best of luck and cheers!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload