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

Re: What's cooking in git.git (Jul 2017, #03; Mon, 10)

From
Jeff King <peff@peff.net>
Date
Jul 13, 2017, 20:49 UTC
Message-ID
<20170713204946.wfshkwpqoiwqgkft@sigill.intra.peff.net>
In-Reply-To
<xmqqvamww3tc.fsf@gitster.mtv.corp.google.com>
On Thu, Jul 13, 2017 at 12:10:39PM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> >   - I suspect in the third example we probably ought to be using the
> >     reflog of the branch that HEAD points to. You would not want:
> >
> >        $ git checkout advanced-branch $ git checkout older-branch $ git
> >        push --force-with-lease origin HEAD:older-branch
> >
> >     to consider that commits in advanced-branch are part of the lease.
> 
> The third one was meant to be rewriting on detached HEAD, not having
> any underlying branch.

Ah, OK, that makes a lot more sense. I'd be tempted to say that it should not allow force-with-lease at all. The HEAD reflog sees too many unrelated things to make it a good basis for "does this result account for everything in its reflog".

Show 10 quoted lines
> >   - For step 3, I'm not sure if we you mean to look for exactly X, or
> >     if it would be OK to have any commit whose ancestor is X. I think
> >     you'd need the latter to accommodate a non-fast-forward "git pull"
> >     (or fetch+merge) where the local ref is never set precisely to the
> >     upstream commit.
> 
> But the result in that case is a descendant of upstream you just
> merged, so you do not even want to use any form of forcing---you
> would rather want to rely on the usual "push must fast-forward"
> mechanism, no?

Sorry, I mean the case where you do a merge from the other side, but then you end up rewinding the history in some way, taking into account that merge and everything they did. For example:

  $ git pull
  $ git rebase  ;# this will flatten the merge
  $ git push --force-with-lease

There was never a moment where the other side's tip ref was in your local branch, but you did incorporate it via the merge.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 17 in “What's cooking in git.git (Jul 2017, #03; Mon, 10)”
  1. Junio C HamanoJul 10, 2017
  2. Lars SchneiderJul 11, 2017
  3. Jeff KingJul 11, 2017
  4. Lars SchneiderJul 11, 2017
  5. Jeff KingJul 11, 2017
  6. Junio C HamanoJul 11, 2017
  7. Junio C HamanoJul 11, 2017
  8. Johannes SchindelinJul 13, 2017
  9. Junio C HamanoJul 13, 2017
  10. Jeff KingJul 13, 2017
  11. Junio C HamanoJul 13, 2017
  12. Junio C HamanoJul 13, 2017
  13. Jeff KingJul 13, 2017
  14. Junio C HamanoJul 13, 2017
  15. Junio C HamanoJul 13, 2017
  16. Jeff KingJul 13, 2017
  17. Junio C HamanoJul 13, 2017

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.