Re: move directories in work dir
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:09
"Rogelio M. Serrano Jr." [off-list ref] writes:
... is there a way to tell git that i moved a directory into another? For example i have.
Before you moved them, you could have done [*1*]:
$ mkdir analyze/import_tools
$ git rename analyze/import_a analyze/import_tools/import_a
$ git rename analyze/import_b analyze/import_tools/import_b
But that may be too late now. Instead you already did:
$ mkdir analyze/import_tools
$ mv analyze/import_a analyze/import_b analyze/import_tools/.
At this point, you can:
$ git-add analyze/import_tools
$ git-ls-files analyze/import_a analyze/import_b |
git-update-index --remove --stdin
right now i have to do git-update-index --add for everything all over again.
"git rename" is just a short-hand of your manual "git-update-index --add --remove" (and at the same time moving files in the working tree). There isn't any extra information you are giving git by using it (IOW "git" does not record renames). BTW, do you really have a file whose name ends with an ESC character?
analyse/import_a/import_a.c
[Footnote] *1* It strikes me that git rename *could* be friendlier by emulating how "mv" treats the paths parameters (current implementation insists two parameters $src and $dst). What do you think, Ryan?