Monday, 15 July 2013

git - Merge from upstream with no upstream history -


I have a parent repo with my project, and a sub-repo that is far away from this project.

The parent repo has tagged the release, and the sub-report is based on one of these tags. For example:

  Parents v1.0 --- v2.0 --- v3.0 \ child --- [changes]  

Unfortunately when the baby was made repo, the guardian history was removed and the repo was resumed with the files attached to the scratch. So this means that any of the parents repo's history is contained within the repo, rather, a start was made on the basis of the parents v2.0 tag in committed to indicate, where v2. All of the 0 files were adding Git ed.

Despite the absence of any parent's history, is there a way to use the guit to merge upstream changes with parents (eg V3.0 tag)?

git pull tells me that there is no common committance, so it does not know where to start merge me?)

Obviously this is a strange scenario and not one I will allow in the future>

then I recommend that you rewrite the history of the child repo v2.0 History.

I think the branch is called master in both codes.

So first we add a remote to the parents repo and bring it

 $ cd / path / to / child / repo $ git Add remote child & Lt; Url_or_path_for_parent_repo & gt; $ Git Fetch Original  

Then you can find out the v2.0 tag (one with full history):

  $ Git rev-parse v2.0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa  

and firstly, with the whole v2, a committed, branch in the Master branch. 0 History crushed in a committed:

  $ git checkout master $ git log --reverse --format = format:% H | Head-n 1bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb  

Then, we swap the master branch to parent bbbbb .. aaaaa ... (please replace bbbbb .. . And Aaaaa ... given above the actual results of commands given in the command given below)

  $ git filter-branch - parent-filter 'read p; If ["$ p" = "-p bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"]; Then the echo "-Aaadaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiaiai"; The second "echo $ p"; Fi 'rewrite cccccccccccccccccccccccccccccccccccccccccccccccccc (d / d) referee was written in' refs / head / master ' 

After this its master branch should now be changed With the history of the first crushing committed code, v2.0 tag.

If something went wrong, you can return the master branch back to the original state:

$ git reset - After you verify the results and are happy, you can do the following by original / rifs / head / master backup branch:

>

Master in the branch v3.0 tag dead Will be able to do so.


No comments:

Post a Comment