Open dannyroberts opened 9 years ago
Seems like a nice use case, I would like to know how @spacewander feels about this.
@dannyroberts Can you describe what occasions we can use it? Will it be used frequently? This looks like a good tip, is it useful enough to be a tool?
I think the main use case is in reorganizing a large project that has many modules for example. You might feel stuck because it doesn't feel worth it to move whole directories to more logical places if it means that the entire history of that module is basically lost (think git log, git blame on individual files), and if there's a large team of people working on the project and branches they have with changes to the files you moved will be completely unmergeable.
If you use git move-tree
or whatever we'd theoretically call this git-extra, then you can feel a lot freer to reorganize code without disrupting your entire team's workflow.
It sounds good. What about your opinions? @hemanth
if there's a large team of people working on the project and branches they have with changes to the files you moved will be completely unmergeable.
^ sounds like a highly probable scenario.
Ok so this sounds like a valuable thing for me to script up? I'll set some time aside this weekend to do a first pass on it and do some more testing. If all goes well you'll get a PR from me shortly
:shipit:
(Not too surprisingly I got distracted in the middle of my short weekend coding session. Making more time next weekend.)
NP, take your time :+1:
This "issue" is more of a request for comments from anyone working on this repo that knows what they're talking about when it comes to git internals. In exchange for comments, I will happily turn this into a PR.
I "discovered" a way to move a directory that also preserves history, including dealing well with merges from code branched before the move: https://gist.github.com/dannyroberts/857b9f7e52acd6b83c89. I say "discovered" because I couldn't find instructions for this anywhere on the internet, but this is what is recommend for doing a "subtree merge" from another repository, and when I tested it, it also worked quite nicely for directories within the same repo.
I think it'd be really great to add to git extras—can any of you who know more than me think of why this might specifically be a bad idea?