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

Re: A git problem with timestamps

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 7, 2008, 20:03 UTC
Message-ID
<7vvdx7lo4x.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200809070954.03394.armyofthepenguin@gmail.com>
Rod <armyofthepenguin@gmail.com> writes:
Show 16 quoted lines
> Here are the git commands Fred is attempting to use:
> # Branch the *base* of master
> git checkout -b updated_original_source_code 345678
>
> cp ../updated_source_code.tar.gz .
> tar zxvf updated_source_code.tar.gz
>
> # Commit all changes from original_source_code
> # to updated_source_code
> git -a -m "Updated original source code"
>
> # Now apply the history of master onto this branch:
> # This is where they get hosed because the timestamps
> # from Barney's commits are wrong, and hence the 
> # generated patches are out of order.
> git format-patch 345678..master | git am -k -3

First of all, the branch name "updated_original_source_code" does not make much sense. When you get another round of source tarball update, what would you do? Create "updated_original_source_code_2"? The one after that is "updated_original_source_code_3"?

That misses the whole point of revision control, doesn't it?

You instead keep an "upstream" branch, whose tip might be at 345678 before accepting the tarball update, and you advance its tip only with the upstream updates:

      Barney               o---o---o       o---o
                          /         \     /     \
      Fred   o---o---o---o---o---o---o---o---o---o
            /
        ---o---------------------------------------o
           ^                                       ^
           upstream ===== (tarball update) ======> upstream

You can tag its tip after every time you accept the tarball update from your upstream.

A natural thing to do from there is to _merge_ upstream changes to your shared development, that results in:

      Barney               o---o---o       o---o
                          /         \     /     \
      Fred   o---o---o---o---o---o---o---o---o---o---*
            /                                       /
        ---o---------------------------------------o
           ^                                       ^
           upstream ===== (tarball update) ======> upstream

Of course you could rebase all history on top of updated upstream (buy why bother? -- you are not keeping a linear history by cross merging between two developers already, so there is no point doing a "format-patch | am" sequence to linearlize your history at this point), and --topo-order given to format-patch may help with broken timestamps one of you recorded.

Previous: Rod
Message 2 of 2 in “A git problem with timestamps”
  1. RodSep 7, 2008
  2. Junio C HamanoSep 7, 2008

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.