git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Joshua Phillips <jphillips@imap.cc>
Cc: git@vger.kernel.org
Subject: Re: Possible bug: git pull --rebase discards local commits
Date: Tue, 23 Aug 2016 12:28:59 -0700	[thread overview]
Message-ID: <xmqqvayruvwk.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1471969497.3553135.703756633.0F6CCC4C@webmail.messagingengine.com> (Joshua Phillips's message of "Tue, 23 Aug 2016 16:24:57 +0000")

Joshua Phillips <jphillips@imap.cc> writes:

> I've found a case where git pull --rebase discards commits in my branch
> if the remote-tracking branch was rewound (and the remote tracking
> branch's reflog contains my branch's latest commit). This is due to
> git-pull's usage of git merge-base --fork-point.
>
> On one hand, this behaviour might be correct since the remote repository
> essentially removed that commit from master by 'reset --hard'. On the
> other hand, I was surprised that git pull --rebase discarded a commit in
> my branch.

Yup, that sounds like a bad way to handle the situation.  After all,
the upstream may have first accepted your first attempt, and then
decided that it was premature and rewound it, expecting you to give
an improved reroll.  But I also agree with you that it may be
correct to drop it because the upstream already rejected it.

Since Git cannot tell between these two cases, we should play safer
than what the current code does, I would think.


  reply	other threads:[~2016-08-23 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 16:24 Possible bug: git pull --rebase discards local commits Joshua Phillips
2016-08-23 19:28 ` Junio C Hamano [this message]
2017-03-10  0:23   ` Igor Djordjevic

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqvayruvwk.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jphillips@imap.cc \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).