Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

I think the problem was caused because:

  1. I accidentally committed something (let's call it A) on live instead of master.
  2. I then committed something else (B say) on master.
  3. I realised I made the mistake 1. and merged live onto master.
  4. I still needed to merge B onto live, so I merged master onto live.

I think this created a "crossing" of commit paths that makes it impossible for git merge to fast-forward.

The solution was to first ensure that the two branches really did have the same contents:

git diff master..live git cherry -v master live git cherry -v live master 

all yielded no result. Then I changed live to point at exactly the same commit as master:

git branch -f live ae5e70... # Hash of the commit pointed to by master git push --force origin live:live 

Now I can fast-forward again. Note that this can be dangerous and should probably not be done when the repository is sharedthis can be dangerous and should probably not be done when the repository is shared.

I think the problem was caused because:

  1. I accidentally committed something (let's call it A) on live instead of master.
  2. I then committed something else (B say) on master.
  3. I realised I made the mistake 1. and merged live onto master.
  4. I still needed to merge B onto live, so I merged master onto live.

I think this created a "crossing" of commit paths that makes it impossible for git merge to fast-forward.

The solution was to first ensure that the two branches really did have the same contents:

git diff master..live git cherry -v master live git cherry -v live master 

all yielded no result. Then I changed live to point at exactly the same commit as master:

git branch -f live ae5e70... # Hash of the commit pointed to by master git push --force origin live:live 

Now I can fast-forward again. Note that this can be dangerous and should probably not be done when the repository is shared.

I think the problem was caused because:

  1. I accidentally committed something (let's call it A) on live instead of master.
  2. I then committed something else (B say) on master.
  3. I realised I made the mistake 1. and merged live onto master.
  4. I still needed to merge B onto live, so I merged master onto live.

I think this created a "crossing" of commit paths that makes it impossible for git merge to fast-forward.

The solution was to first ensure that the two branches really did have the same contents:

git diff master..live git cherry -v master live git cherry -v live master 

all yielded no result. Then I changed live to point at exactly the same commit as master:

git branch -f live ae5e70... # Hash of the commit pointed to by master git push --force origin live:live 

Now I can fast-forward again. Note that this can be dangerous and should probably not be done when the repository is shared.

Source Link
user4571464
user4571464

I think the problem was caused because:

  1. I accidentally committed something (let's call it A) on live instead of master.
  2. I then committed something else (B say) on master.
  3. I realised I made the mistake 1. and merged live onto master.
  4. I still needed to merge B onto live, so I merged master onto live.

I think this created a "crossing" of commit paths that makes it impossible for git merge to fast-forward.

The solution was to first ensure that the two branches really did have the same contents:

git diff master..live git cherry -v master live git cherry -v live master 

all yielded no result. Then I changed live to point at exactly the same commit as master:

git branch -f live ae5e70... # Hash of the commit pointed to by master git push --force origin live:live 

Now I can fast-forward again. Note that this can be dangerous and should probably not be done when the repository is shared.