开发者

git merge X reports up-to-date

开发者 https://www.devze.com 2023-01-24 19:07 出处:网络
I have a remote repository on a UNC \\foobar\\Git\\MKWF.gif i have two local clones, the first is used for normal development so it really has two branches that track, master and stable. Development

I have a remote repository on a UNC \foobar\Git\MKWF.gif

i have two local clones, the first is used for normal development so it really has two branches that track, master and stable. Development is done in master, then merged into stable.

Stable is the branch all other branches come off. This is a basic web framework used for a number of sites.

second clone is a specific one for site X.com

so X.com tracks master, stable and a new branch X

normally I work in the first repository on general stuff, merge into stable when ready then git push --all to move the changes to the server.

in the X.com clone I do:

git checkout st开发者_Go百科able
git pull --all 

this gets me the lastest changes from the server then I can do

git checkout X
git merge stable

to move these updates into the specific branch for X.com

however this has stopped working

I've done the pull, I can see the files in windows explorer I then do

git checkout X
git merge stable

all the files are gone and merge reports "its uptodate"

can someone illuminate the problem ? git branch -a lists all the local branches and the remote ones.

git status reports nothing. Why are my files not there...


You probably accidentally

  1. merged
  2. undid local changes
  3. committed that

The remaining (potentially empty) commit would still be marked as a merge commit, meaning that it will have two parents (the prior commit on X and the tip of stable at the time of merge).

You then spot that you haven't actually merged the new files in (meaning: you did'nt commit them properly). Any attempt to do the merge again, will fool git because it can clearly see that the last revision is already a direct child of the tiprevision on stable. This means there shouldn't be any work left.

What git does to find out the starting point for a merge is 'git merge-base X stable', so you can verify this. (You probably still can by reviewing the revisions still in the reflog for X[1]).

Next time when in doubt, peruse

 git show-branch X stable

to visually inspect the situation or

 git log X..stable

and

git log --graph --cherry-pick --oneline --left-right --boundary X...stable

For increasingly detailed information.

[1] e.g.

git rev-list -g HEAD --parents
git rev-list -g HEAD --children

to find the bad merge point

0

精彩评论

暂无评论...
验证码 换一张
取 消