Finding where source has branched from git

后端 未结 6 1052
天命终不由人
天命终不由人 2021-01-05 05:22

I have a git repository (covering more or less project history) and separate sources (just a tarball with few files) which have forked some time ago (actually somewhere in 2

6条回答
  •  清歌不尽
    2021-01-05 06:07

    how was the fork made? was it a clone that someone else made and then did their own work? if so, then this is really easy. all you need to do is create a local branch that pulls in the code from the fork. git will see the ancestry of the forked branch pointing to one of the commits from your original repository and will "connect the dots" so to speak... it will reconnect the history from your original repository to the fork.

    you should be able to do this:

    git remote add thefork git://wherever.it.lives/thefork.git
    
    git fetch thefork
    
    git branch -f thefork-branch thefork/branchname
    
    git checkout thefork-branch
    

    at this point, you can run gitk and see the complete history of the forked branch and your local repository, and see if they connect or not.

提交回复
热议问题