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

Re: how to move with history?

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jun 18, 2007, 19:49 UTC
Message-ID
<20070618194907.GA12445@steel.home>
In-Reply-To
<20070618191607.GK3037@cs-wsok.swansea.ac.uk>
Oliver Kullmann, Mon, Jun 18, 2007 21:16:07 +0200:
> 2. I issue "git mv file new_file".
> 
> 3. Then I have to commit the renaming.  I can't find anything on how
> to do this (neither in the git-mv- nor in the git-commit-documentation).

Just git-commit. git-mv is only so you don't have to run git add on the new file name and don't need to run "git-commit -a" afterwords.

> So a hack is to use "git commit -a".  Apparently this works.
Even a plain "mv file new_file; git add new_file" would have worked.
> 4. Now I have "new_file" in the repository, but without history
> (except of the renaming operation),
It does. Try "git log file new_file". After committing, that is
> and I have still "file" in this history, but I can no longer get
> access to the history of "file" via "gitk file" ?
Well, you didn't commit the change yet.
> This looks a bit strange to me (the renamed file has
> no history, the old file still lurking around, but not
> easily accessible).

Git does not keep "renaming history". It does not have to, as it keeps how your project looked at each commit (point in history).

Previous: Oliver KullmannNext: Oliver Kullmann
Message 2 of 9 in “how to move with history?”
  1. Oliver KullmannJun 18, 2007
  2. Alex RiesenJun 18, 2007
  3. Oliver KullmannJun 18, 2007
  4. J. Bruce FieldsJun 18, 2007
  5. Frank LichtenheldJun 18, 2007
  6. Robin RosenbergJun 18, 2007
  7. Alex RiesenJun 18, 2007
  8. Oliver KullmannJun 19, 2007
  9. Jakub NarebskiJun 19, 2007

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.