From: Neal Kreitzinger <nkreitzinger@gmail.com>
To: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Cc: Git Users <git@vger.kernel.org>
Subject: Re: Master and origin/master diverged
Date: Fri, 22 Jun 2012 18:47:29 -0500 [thread overview]
Message-ID: <4FE50411.8080800@gmail.com> (raw)
In-Reply-To: <CAE1pOi2MN_c76UBeRzdRbU8s+0LzYVoVcJ13V0di=HQobj+aDg@mail.gmail.com>
On 6/22/2012 3:18 PM, Hilco Wijbenga wrote:
>
> On 22 June 2012 12:01, Neal Kreitzinger <nkreitzinger@gmail.com> wrote:
>> On 6/22/2012 12:53 PM, Hilco Wijbenga wrote:
>>>
>>> One of my developers managed to push something that somehow "diverged"
>>> origin/master from everyone else's local master.
>>>
>>> A --> B --> C --> D (everybody's local master)
>>> |
>>> \--> B' --> C' --> D' --> E (origin/master)
>>>
>>> (i.e., A is the commit where things diverged; everyone's local master
>>> points to D but the new commit (E) that was pushed to origin/master
>>> uses different SHA1s for B, C, and D)...
>>>
>>> Now running git pull creates a merge commit joining D and E.
>>>
>>> ...Does anyone have any idea as to what might have happened? Perhaps if I
>>> understand how this happened I might be able to prevent it from
>>> happening again.
>>>
>> Some ways you can prevent it from happening again:
>
>> (2) have your devs do git pull --ff-only
>
> Is this something that can be set in git config? I looked but didn't
> see anything obvious.
OTTOMH, you could change the git fetch config for master and take away
the leading '+' sign which would not allow non-fastforward fetches of
master. That in turn would prevent merging such a non-ff remote
tracking branch of master into your branch master.
Actually, I guess what I really want is
> something for git push, right?
>
Some ways to do it:
(1) I think you could have rebase and commit hooks locally that prevent
someone from rewriting history on master. That in turn would prevent
someone from pushing a rewritten history.
(2) When merging topic branches to master use git merge --ff-only. Then
when you push it to remote master you know it's a fastforward and not a
history rewrite.
v/r,
neal
next prev parent reply other threads:[~2012-06-22 23:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-22 17:53 Master and origin/master diverged Hilco Wijbenga
2012-06-22 18:34 ` Phil Hord
2012-06-22 20:14 ` Hilco Wijbenga
2012-06-22 22:10 ` Phil Hord
2012-06-22 22:33 ` Hilco Wijbenga
2012-06-22 19:01 ` Neal Kreitzinger
2012-06-22 20:18 ` Hilco Wijbenga
2012-06-22 23:47 ` Neal Kreitzinger [this message]
2012-06-26 2:49 ` Hilco Wijbenga
2012-06-27 5:54 ` Neal Kreitzinger
2012-06-22 23:59 ` Junio C Hamano
2012-06-26 2:58 ` Hilco Wijbenga
2012-06-26 4:11 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FE50411.8080800@gmail.com \
--to=nkreitzinger@gmail.com \
--cc=git@vger.kernel.org \
--cc=hilco.wijbenga@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.