Git-subrepo: trying to pull changes: git-subrepo: Can't find a common ancestor ...

Created on 12 Feb 2018  路  6Comments  路  Source: ingydotnet/git-subrepo

Probably a dup of #345 but easier to merge issues than split them so I'm opening a new issue.

Trying to get the new changes in an upstream repo (of a subrepo) into my local subrepo clone and getting the dreaded:

$ git subrepo pull include
git-subrepo: Can't find a common ancestor between refs/subrepo/include/fetch and subrepo/include. This might be the case if someone used push --force on the subrepo. You need to find out why and possibly reclone the subrepo.

The subrepo's .gitrepo:

; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
    remote = [email protected]:intel-hpdd/module-tools.git
    branch = master
    commit = ae6b9b5c2ef099690d0b0f3bd8ee184023f5c8a5
    parent = af164f912c5d61faf3b6d3809ec7a31f3668ee63
    cmdver = 0.3.1

Verbose output:

$ git subrepo -v pull include
* Fetch the upstream: [email protected]:intel-hpdd/module-tools.git (master).
  * Fetch '[email protected]:intel-hpdd/module-tools.git' (master).
  * Get the upstream subrepo HEAD commit.
  * Create ref 'refs/subrepo/include/fetch'.
* Deleting old 'subrepo/include' branch.
* Create subrepo branch 'subrepo/include'.
  * Check if the 'subrepo/include' branch already exists.
  * Get commits specific to the subdir.
  * Remove the .gitrepo file from the history.
  * Create branch 'subrepo/include' for this new commit set.
  * Reset to the 'modulize' branch.
* Find common ancestor (with same treehash).
* source1 side: 9 commits
* target1 side: 29 commits
* No ancestor found
git-subrepo: Can't find a common ancestor between refs/subrepo/include/fetch and subrepo/include. This might be the case if someone used push --force on the subrepo. You need to find out why and possibly reclone the subrepo.

So once again I am going to have to simply throw the existing subrepo away and re-clone. I am not seeing any value at all in using git subrepo since every time I want to do something I have to throw away what I have and reclone. I don't even get any value out of being able to push changes form a subrepo to it's upstream either.

Bug Solved by 14216

All 6 comments

@brianjmurrell Could you test with the release/0.4.0 branch? The algorithm for 0.3.X version is a little bit flawed due to some assumptions made by me.

@grimmySwe Can I use _release/0.4.0_ with a subrepo created with master or should I do a clean subrepo clone with _release/0.4.0_?

@brianjmurrell You should be able to use release/0.4.0 on it

I can both, relate to the issue with the current master branch as well as confirm the issue is solved in the 0.4.0 branch.

I also recently ran into this on master, got 0.4.0 and it solved my problem. Thanks.

0.4.0 has reached master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

casnacaj picture casnacaj  路  9Comments

phest picture phest  路  6Comments

psorowka picture psorowka  路  5Comments

danielbsig picture danielbsig  路  7Comments

Wagner59 picture Wagner59  路  8Comments