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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 14, 2012, 18:49 UTC
Message-ID
<7vlihh9ulo.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAE1pOi2DZNkYYwkH1MFh0m708T=DEdJawZCQgvk1HTGrqjkz2w@mail.gmail.com>
Hilco Wijbenga <hilco.wijbenga@gmail.com> writes:
Show 9 quoted lines
> I suppose I'm not entirely clear on how this two step process is
> "safer". Doing "git fetch" would seem to be harmless, right? So the
> problem is with "git merge" but master should always be "behind"
> origin/master so that "git merge" should just FF to origin/master
> which *should* be completely safe. Does that make sense? Especially
> given our use of master as an integration branch?
>
> [Given the trouble I have with getting people to use Git properly, I
> prefer things as simple as possible. :-) ]

Between the two procedures Thomas gave you, "fetch & rebase" is safer than "fetch & reset --hard", exactly because it does not have to rely on the validity of your "which should always be behind" claim.

If it is behind, there won't be any difference, but if it is *not*, the user will notice and won't lose his work on 'master' (which you may argue that he shouldn't have done). "rebase" will notice it.

The key for a procedure to be safe is not having to rely on the claim of users such as "my history *should* always and already be behind", and not silently lose information when these *should*s are violated for whatever reason. After all, if all these *should*s were true, the user wouldn't have been having problems in the first place and posting to the list asking for help in the first place ;-)

Previous: Hilco WijbengaNext: Thomas Rast
Message 6 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.