Merge branches, except for file moves and deletions, with git -


is there way when merging git not merge file moves , deletions?

we've made branch , trimmed down branch deleting or moving large number of files. there have been number of modifications made in branch reorganized files. want merge full branch changes made trimmed-down directory, still keep files deleted in trimmed-down branch, , keep of files in original locations.

is there easy way git merge changes trimmed-down branch, while not doing of file deletions or moves? preferably 1 can handle fact modified files have been moved.

note i'm concerned content of changes, rather branch history, approaches use cherry-picking or rebasing fine. (as long don't have manually trawl through commit history isolate commits modification changes.)

i found how ignore file deletions in git branch merging purposes?, question there prospective, , answer "don't that". in situation branching , deletion has occurred.

this isn't in git. there way it, shell scripting instead. didn't specify environment, solution unix environment. there should tools running bash scripts regardless.

first, if branches have diverged have changes on both branches want "merge", want rebase. lets call branches master , deletions. if have pushed deletions else working on branch, create new identical branch deletions2 rebase on master avoid rewriting history. don't want continue working on deletions anyways since have redo all, way won't destroy anything.

then copy files deletions2 master manually cloning repo , check out 1 branch in 1 copy of repo , other branch in other copy. list tracked files , copy them using simple loop:

deletions2/ $ \ git ls-tree head -r | while read f; \ # use -n keep master versions, -f keep deletions versions, \ # or -i choose manually each file \ cp -f "$f" ../master/ \ done


Comments