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

Re: Your branch and 'origin/master' have diverged

From
PJ Weisberg <pj@irregularexpressions.net>
Date
Aug 14, 2012, 16:02 UTC
Message-ID
<CAJsNXTmUB-isPVHPcWupL-gAag--DzhdkazXj0Z+aEbv+_w7Rg@mail.gmail.com>
In-Reply-To
<CAE1pOi1WTbMSK8dOus6pFCa2C9vGA8QNE3+8w0LFmGkvcfq5fg@mail.gmail.com>

On Mon, Aug 13, 2012 at 12:58 PM, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:

Show 20 quoted lines
> Hi all,
>
> A colleague of mine (after a relatively long absence) noticed the
> following when running "git status":
>
> # On branch master
> # Your branch and 'origin/master' have diverged,
> # and have 250 and 19 different commit(s) each, respectively.
> #
> nothing to commit (working directory clean)
>
> He asked me what to do and I told him to do what has always worked for
> me in the past when something like this happened: gitk, "reset master
> branch to here" (to a commit before the divergence and using --hard),
> git pull origin master. Problem solved.
>
> Well, not this one. This one is persistent. :-) I am at a loss what to
> do. "master" and "origin/master" do *not* point at the same commit.
> Even after the "git reset --hard ..." and "git pull". Running my
> silver bullet solution gets us in the same situation every time.

I assume that the commit you reset to wasn't actually before the divergence, then. It sounds like what you're trying to do is just long-hand for 'git reset --hard origin/master'. As mentioned before, that *does* assume that you want to throw out everything you've committed locally. If that's *not* the case, try 'git rebase origin/master' or 'git pull --rebase'. And then go slap the person who rewrote the history of origin/master.

-PJ

Gehm's Corollary to Clark's Law: Any technology distinguishable from magic is insufficiently advanced.

Previous: Junio C HamanoNext: Hilco Wijbenga
Message 19 of 20 in “Your branch and 'origin/master' have diverged”
  1. Hilco WijbengaAug 13, 2012
  2. Thomas RastAug 14, 2012
  3. Hilco WijbengaAug 14, 2012
  4. Junio C HamanoAug 14, 2012
  5. Hilco WijbengaAug 14, 2012
  6. Junio C HamanoAug 14, 2012
  7. Thomas RastAug 14, 2012
  8. Junio C HamanoAug 14, 2012
  9. Thomas RastAug 15, 2012
  10. Junio C HamanoAug 15, 2012
  11. Holger Hellmuth (IKS)Aug 15, 2012
  12. Junio C HamanoAug 15, 2012
  13. Junio C HamanoAug 15, 2012
  14. Jeff KingAug 16, 2012
  15. Junio C HamanoAug 16, 2012
  16. Jeff KingAug 16, 2012
  17. Hilco WijbengaAug 14, 2012
  18. Junio C HamanoAug 14, 2012
  19. PJ WeisbergAug 14, 2012
  20. Hilco WijbengaAug 14, 2012

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.