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

Re: git merge/rebase ref -P ref

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 29, 2013, 03:46 UTC
Message-ID
<7vvc76ngm9.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAKkAvawit0L4JKKNs7Di46B=Y0VjPohKNbjnS=r07VhafXu4kQ@mail.gmail.com>
ryenus <ryenus@gmail.com> writes:
> The inverted meaning of {ours,theirs} for rebase could be very
> confusing to some, especially to new uses, for me every time I
> merge/rebase I need to think about it to make sure I've made it right.

The key point to remember is "git rebase origin master" is *not* about integrating other people's changes to your work. It is a way to replay your work on top of others' work.

When I try to rebase a topic, e.g.
    git checkout jc/format-patch
    git rebase 8ee3860
    
The conflicts in pretty.c looks like this:
    <<<<<<< HEAD
    static const char *show_ident_date(const struct ident_split *ident,
                                       enum date_mode mode)
    {
    ...
            return show_date(date, tz, mode);
    =======
    static int is_current_user(const struct pretty_print_context *pp,
                               const char *email, size_t emaillen,
                               const char *name, size_t namelen)
    {
    ...
                    !memcmp(myname, name, namelen));
    >>>>>>> format-patch: --inline-single
    }

We are replaying the commits on "jc/format-patch" topic on a history that leads to 8ee3860, and the line ">>>>>" shows what commit we are replaying

    $ git log --oneline 8ee3860..jc/format-patch
    be1a07f format-patch: --inline-single
    47d6c5f format-patch: rename "no_inline" field

On the other hand, when I try to do the same integration with a merge, e.g.

    git checkout 8ee3860
    git merge jc/format-patch
We would see the same conflicts like this:
    <<<<<<< HEAD
    static const char *show_ident_date(const struct ident_split *ident,
                                       enum date_mode mode)
    {
    ...
            return show_date(date, tz, mode);
    =======
    static int is_current_user(const struct pretty_print_context *pp,
                               const char *email, size_t emaillen,
                               const char *name, size_t namelen)
    {
    ...
                    !memcmp(myname, name, namelen));
    >>>>>>> jc/format-patch
    }

Again, the name of the branch that is merged appears on ">>>>>" line.

Previous: ryenus
Message 2 of 2 in “git merge/rebase ref -P ref”
  1. ryenusApr 28, 2013
  2. Junio C HamanoApr 29, 2013

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.