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

Re: How to deal with historic tar-balls

From
NKNeal Kreitzinger <nkreitzinger@gmail.com>
Date
Jan 7, 2012, 19:18 UTC
Message-ID
<4F089A95.9050300@gmail.com>
In-Reply-To
<4F079BA1.3060907@gmail.com>
On 1/6/2012 7:10 PM, nn6eumtr wrote:
Show 8 quoted lines
> Thanks for the response, there is lots of good information there.
>
> One clarification - can you track renames in git? I tried using git mv 
> but from the status output it looks like it deleted the old file  and 
> added the new file. I was expecting it to record some sort of 
> indicator of the name change, instead it looks like a short-cut for 
> delete & add, the docs aren't clear if that is the case.
>

(note: top-posting is not advised.) You are exactly right in your observation: git-mv is only a shortcut for 'remove old then add new'. Git does not explicitly track "renames". It can detect renames easily in the cases where you really just renamed the file and left the contents the same. Git tracks content (and trees) as opposed to files (and file names). Git stores the 'blob', aka 'contents' of files in the object store. So if you have 30 files with different names and the exact same contents in your work tree they are stored as a single blob in the .git/objects "object store". If some of your "renames" are really "I renamed it and then I modified it" then git will have a harder time detecting the "rename" depending on how much you modified it. In such cases what you really did is arguably not a "rename" anyway. You can record your "renames" manually in your commit message if appropriate. If you have 5 minutes you can watch this video from the 15:00 min to 20:59 min marks to get an explanation of git-mv and rename-detection: http://www.youtube.com/watch?v=j45cs5_nY2k (youtube searchstring: 'git google tech talks', result: 'contributing with git'.)

v/r, neal

Previous: Thomas Rast
Message 12 of 12 in “How to deal with historic tar-balls”
  1. nn6eumtrDec 31, 2011
  2. Tomas CarneckyJan 1, 2012
  3. Philip OakleyJan 1, 2012
  4. Philip OakleyJan 1, 2012
  5. Philip OakleyJan 2, 2012
  6. Dirk SüsserottJan 2, 2012
  7. Philip OakleyJan 4, 2012
  8. Dirk SüsserottJan 1, 2012
  9. Neal KreitzingerJan 5, 2012
  10. nn6eumtrJan 7, 2012
  11. Thomas RastJan 7, 2012
  12. Neal KreitzingerJan 7, 2012

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.