From: "Dale R. Worley" <>
To: <>
Sent: Thursday, November 29, 2012 7:50 PM
Subject: Re: [git-users] Pushing files into a subtree

From: Ryan Hodson <>

If you're not looking for a submodule, you can just move the tracked files into a subdirectory with 'mv' or through your file browser. Then run 'git add .' in the project root and Git will figure out the file renames on its
own. The 'git mv' command can be used to the same effect.

OK, so it seems that when you move files around, and then tell git to
notice that, git will automagically figure out what the moves were.
The O'Reilly book wasn't clear on that.  (Nor did it explain how git
can distinguish a move from file that just happens to have the same

Actually git does not even attempt to record the movements themselves. There is a strongly worded post by Linus Torvalds all about why he *believes* it is the Right Thing (tm) to do.

The key being that git is a *content* tracker, not a file tracker, and if you commit often the changes are small, so it is easy to infer where the changes came from and went to.

Another question is this:  I believe that the complete repository and
its status lives in the .git directory. So if I move ./.git to ../.git,
it has the same effect as if I moved all the normal files into a
subdirectory of ".".  Is that correct?

Essentially yes, you gain an extra level of structure to your content tree. But test it on a dummy repo first - you will be surprised buy the status messages "help everything's moved..." ;-)




Reply via email to