Git overwriting file changes when doing a merge -
i have git repository teammate forked branch , made commits , remerged reverted , other steps unclear on... changes , made commits on top of merge. caused changes overwritten, such merge pulling in other branch changes commit 3 , if try hard reset , remerge rewrites. i've tried applying patches because of changes in commit 3 cannot apply patch of commit 1, , not wish creat .gitattributes in 5 different directories , specify merge strategy suggested here: is possible exclude specific commits when doing git merge? .
is there simpler way merge , keep changes?
this diagram should show commit structure:
head | commit 1 | commit 2 <-- merge branch mainline | \ | branch-commit 1 | | | branch-commit 2 | | commit 3 | | \ | | commit | * | * *
in case rebasing did not work. issue here fork due reset , remerge reason caused of commits overwritten. branch-commit-* merged mainline.
to fix created patch commits overwritten , reapplied patch:
git format-patch branch-commit-2^..branch-commit-1 --stdout > feature.patch git --signoff < ~/feature.patch
Comments
Post a Comment