I've read in various FAQs that git
doesn't explicitly track renames/moves, preferring to look for identical (or in some situations similar?) files. That's great, but will it cope with this situation: a friend's remote repository has a new feature (i18n) involving some new files at debian/po/*.po
. I have my own fork of this project, and want to merge this feature but put the files at just po/*.po
(I can do that as two commits, or whatever is necessary). I expect the remote repo will continue to receive updates to the feature, and I want to just merge/cherry-pick those commits and have them applied to the files in my new location. Can git
do that, perhaps with some sort of mapping of "these files have moved over here now"? Or is it more pain than it's worth and should I just accept the slightly odd debian
path in my repo?
use git mv
and everything will be AOK.
Why not just try it instead of asking? You can always reset easily in git. :)
Git lacks a mechanism to indicate that you expect there to be path renames and updates when doing the diff between two projects/branches etc.
There are the various file rename options available (such as -M and --patience) but can be slow.
As already stated, the path renames don't affect the repository itself because it is simply a snapshot of your content (blobs) and structure (tree nodes). If all you have done is added an extra top level directory then all the trees and blobs below are unchanged and require zero additional storage. All you need is the one tree node for your commit and one tree node for the new tld. Dead easy. Git handles that part no problem.
It is only when you want to do a comparison (and any patches) that it matters. It would be nice to have say a -P
option that indicates that you expect some path renames and for the diff
to thereby cope easily. It's not good seeing 200 file deletes and 200 new files ;-)
Finding out how to add a -P option is another one of my 'to do' list items (I hope I get some time for it).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With