1

In a group-shared Git repo, I had this repo structure:

      o---o---o---o  branch2
     /
o---o---o---o---o master
 \
  o---o---o  branch1

After aligning it with git flow approach, it became this:

      o---o---o---o  maintenance/branch2
     /  c1
o---o---o---o---o develop
 \       \
  \       o---o---o  master
   \
    o---o---o  maintenance/branch1

So, the 3 branches were renamed:

  • branch1 -> maintenance/branch1
  • branch2 -> maintenance/branch2
  • master -> develop

And a new branch master was created from commit c1.

Changes were pushed on remote and pulled (with prune) on all clients.

Everything was fine, but after some time, after a fetch, the master tip on remote "moves" back to the old tip (same as develop).

I have done (locally and on remote):

git gc --prune="0 days"
git gc --prune=now
git fsck --full

Then, I again delete master from remote, push my local master (created from c1) and everything looks good. I even do a clone to new folder and it comes correctly -- showing new branch structure.

But after some hours/day, master is again "reverted" on the remote!

Remote git reflog shows absolutely nothing (as there were no pushes in the meantime and gc was run a day ago).

Any ideas why the branch keeps moving its tip on the remote?

NB. remote HEAD points to develop.

NB2. this is how I renamed the branches:

git checkout ${ori}
git branch -m ${ori} ${new}
git push origin :${ori}
git push --set-upstream origin ${new}
Saran
  • 3,845
  • 3
  • 37
  • 59
  • Bare repositories (those that accept pushes) usually have reflogs turned off. See http://stackoverflow.com/q/3876206/1256452 – torek Dec 04 '15 at 09:26
  • @torek it hasn't reflog turned off. I know this as there is no config for it and b/c I was looking at it 2 days ago (before the `gc` command). – Saran Dec 04 '15 at 09:50
  • What does running `git branch -vv` show? Is the local develops tracking the wrong branch? – BeaverusIV Dec 05 '15 at 00:40
  • @BeaverusIV the local repo (with `master` changes not pulled) shows the correct comment (from `c1`), but on the remote the `master` branch has the comment same as the `develop`. – Saran Dec 07 '15 at 10:04
  • I was more thinking that each line like such: `update_manifest fea8a74 [origin/update_manifest] Update manifest with reporting files` has the same local branch name and origin/xxx branch name. Also, are multiple people currently using this repo? Could it be someone else's actions reverting your changes by not fetching and being up to date with remote? – BeaverusIV Dec 07 '15 at 20:59
  • @BeaverusIV that is what I thought first (that someone else keeps pushing a merge), but aparently noone is. – Saran Dec 07 '15 at 21:02
  • "After some hours/day" the next step if everything is tracking right is to find out exactly when it is happening. Does it happen right after anyone pushes to remote? Does it happen only after a branch merge? – BeaverusIV Dec 07 '15 at 21:07
  • No one touches the repo and it happens. The only thing that comes to mind it to temporarily rename the remote directory and see if it will happen also. – Saran Dec 07 '15 at 21:09
  • Yeah, move it on the server so that anything that might be referencing it won't find it. See if it changes. Something is triggering it somewhere. – BeaverusIV Dec 08 '15 at 06:09
  • As I suspected, after renaming the git repo dir on the remote, the problem didn't occur again even though the few of us worked on it as usual. My suspicion is on some forgotten tooling working in background and reverting the change. – Saran Dec 10 '15 at 12:19

0 Answers0