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

Re: How to keep log history when renaming and changing simultaneously

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 17, 2017, 12:17 UTC
Message-ID
<CACsJy8B5r+Xoo8s9xbwaUrQhEODzN4Uk5z9RjbKXMwM-W5m=HQ@mail.gmail.com>
In-Reply-To
<ygfpogbb711.fsf@tehran.isnogud.escape.de>
On Mon, Apr 17, 2017 at 6:36 PM, Urs Thuermann <urs@isnogud.escape.de> wrote:
Show 20 quoted lines
> Sometimes I need to rename and change a file in one commit.  One
> example would be a file foo.h that begins with
>
>     #ifndef FOO_H
>     #define FOO_H
>
> which should be renamed bar.h and have the FOO_H changed to BAR_H.
> In subversion I would
>
>     svn mv foo.h bar.h; vi bar.h; svn ci
>
> and then a
>
>     svn log bar.h
>
> also shows the history of that file when it was named foo.h.
>
> This does not work in git.
> ...
> Is there a better way to do this in git?

We could if we allowed rename annotation, similar to that "svn mv" command. I worked on that a while back [1] then I stopped because of a design conflict. But I'm almost convinced Jeff and Junio were right (and I wrong) now so I will likely revive that series before 2019 hits.

[1] http://public-inbox.org/git/1453287968-26000-1-git-send-email-pclouds@gmail.com/
-- 
Duy
Previous: Urs ThuermannNext: Igor Djordjevic
Message 2 of 6 in “How to keep log history when renaming and changing simultaneously”
  1. Urs ThuermannApr 17, 2017
  2. Duy NguyenApr 17, 2017
  3. Igor DjordjevicApr 17, 2017
  4. Urs ThuermannApr 17, 2017
  5. Jacob KellerApr 18, 2017
  6. Junio C HamanoApr 18, 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.