git/list[1] front-page[2] threads[3] people[4] search[5] about
 

How to fix “Your branch and 'origin/master' have diverged” after editing a commit that came before a pull?

From
Yang Zhang <yanghatespam@gmail.com>
Date
Nov 20, 2010, 00:36 UTC
Message-ID
<AANLkTikr+uGrO2EB9WQk+CXeOm7jiYxdbhGzRRvgc9B9@mail.gmail.com>
In the following scenario:
1. Make commits A, B, C
2. Pull, getting commits D, E
3. Make more commits F, G, H, ...
4. Realize that you need to tweak B
5. Tweak B using git rebase -i and git commit --amend
Now git status says:
  Your branch and 'origin/master' have diverged.
How should I fix this? Thanks.
Next: Yang Zhang
Message 1 of 8 in “How to fix “Your branch and 'origin/master' have diverged” after editing a commit that came before a pull?”
  1. Yang ZhangNov 20, 2010
  2. Yang ZhangNov 20, 2010
  3. Jeff KingNov 20, 2010
  4. Yang ZhangNov 20, 2010
  5. Gavin GuoNov 21, 2010
  6. Jeff KingNov 21, 2010
  7. Yang ZhangNov 21, 2010
  8. Jeff KingNov 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.