{"thread":{"id":"30212","subject":"Parallel refactoring and git merge nightmare","startedAt":"2012-04-11T16:13:23Z","lastAt":"2012-04-12T16:03:17Z","messageCount":9,"participants":["Pap Lôrinc","Michael Witten","David Aguilar","Andrew Ardill","Jeff King","David Barr","Eugene Sajine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188976","messageId":"1334160803.74554.YahooMailNeo@web160603.mail.bf1.yahoo.com","threadId":"30212","inReplyTo":null,"subject":"Parallel refactoring and git merge nightmare","fromName":"Pap Lôrinc","fromEmail":"paplorinc@yahoo.com","sentAt":"2012-04-11T16:13:23Z","receivedAt":"2012-04-11T16:13:23Z","isPatch":false,"sender":{"key":"paplorinc@yahoo.com","avatar":null},"body":"Hello! :)\n\nWe are working in parallel on the refactoring of a \nsmall project. The team uses SVN and I decided to give GIT a chance to \ndemonstrate it's merging capabilities I've read so much good about :).\n\nHowever\n - I must be doing something VERY wrong - every time I try to merge from\n the remote svn (git svn fetch and git merge remotebranch) into my \nbranch, I get hundreds of conflicts, mostly because of moved folders.\n\nI\n tried it from the console (latest git), from Idea (11.1.1), from git \nextensions, from gitk, from tortoisegit and they all offer me a \none-by-one resolution of the conflicts, that should have been resolved \nautomatically (in Idea and tortoisegit I can select \"theirs\" to all the \nconflicts, but they still give errors at the end).\n\nI think the \nproblem arises because git doesn't track\n moves, therefore I constantly get conflicts of type \"local modified, \nremote deleted\" (or even both deleted) when in fact it was only modified\n and moved, it could have been merged without conflicts (-> apply my \nchanges and move the file to the new location).\n\nEven if I move \nthe files manually (eg. from totalcommander) to their final locations (I\n have to copy each modified remote file to the new location ... still \nfaster than going through the hundreds of conflicts in git mergetool \nmanually, one-by-one), and added the files to the index, I have to hunt \ndown the duplicated files, and the ones containing the \n\"<<<<<\" conflict markers (which often contain the two \nwhole files ... not just their differences, even though they are clearly\n very similar), delete the merge file leftovers (theirs, base, local \netc), copy the files over manually, that could not be merged etc. This \nis madness, I am merging manually!!!\n\nI don't want conflict\n markers in my files, it's dangerous. Don't spam my files with garbage \n(and commit them later, because it was left unnoticed in the whole \nmanual merge), use temporary files or whatever.\n\nIt would also be \nnice if conflicts could be ignored, if the match a certain regexp (eg. \nmoving the same .java file in parallel might change the package or \nimport statements, which will result in conflicts ... I don't care, use \nwhichever, Idea will correct it anyway, I don't want to go through \nhundreds of files because of this). Some hooks could be activated on \nmerge conflicts also.\n\nWhat am I doing wrong, this manual or \none-by-one merge is absurd :(? I want git to work because of all the bad\n experience I've had with TFS and SVN, but I just can't comprehend this.\n\nThank you for your patience,\nPap Lőrinc\n"},{"id":"188993","messageId":"CAMOZ1Bs4TwL8XD-N8wkkfzEUBHX_s6eh+Y+Ve=O1QN+Ja+XP5w@mail.gmail.com","threadId":"30212","inReplyTo":"1334160803.74554.YahooMailNeo@web160603.mail.bf1.yahoo.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2012-04-11T16:49:20Z","receivedAt":"2012-04-11T16:49:20Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"2012/4/11 Pap Lôrinc <paplorinc@yahoo.com>:\n> What am I doing wrong\n\nProbably a lot.\n"},{"id":"189069","messageId":"CAJDDKr6v6uPLoAQ96fP7JM5F0_WHqfbaD=QKyfrWPWd2St7tKQ@mail.gmail.com","threadId":"30212","inReplyTo":"1334160803.74554.YahooMailNeo@web160603.mail.bf1.yahoo.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2012-04-12T03:27:01Z","receivedAt":"2012-04-12T03:27:01Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"2012/4/11 Pap Lôrinc <paplorinc@yahoo.com>:\n> Hello! :)\n>\n> We are working in parallel on the refactoring of a\n> small project. The team uses SVN and I decided to give GIT a chance to\n> demonstrate it's merging capabilities I've read so much good about :).\n>\n> However\n>  - I must be doing something VERY wrong - every time I try to merge from\n>  the remote svn (git svn fetch and git merge remotebranch) into my\n> branch, I get hundreds of conflicts, mostly because of moved folders.\n\nGoogle is your friend\n\nhttps://wiki.kuali.org/display/KULRICE/git-svn+how+to\n\nhttp://flavio.castelli.name/howto_use_git_with_svn\n\nhttp://viget.com/extend/effectively-using-git-with-subversion\n\nhttp://java.dzone.com/articles/how-start-using-git-svn-based\n-- \nDavid\n"},{"id":"189070","messageId":"1334208237.82681.YahooMailNeo@web160606.mail.bf1.yahoo.com","threadId":"30212","inReplyTo":"CAJDDKr6v6uPLoAQ96fP7JM5F0_WHqfbaD=QKyfrWPWd2St7tKQ@mail.gmail.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"Pap Lôrinc","fromEmail":"paplorinc@yahoo.com","sentAt":"2012-04-12T05:23:57Z","receivedAt":"2012-04-12T05:23:57Z","isPatch":false,"sender":{"key":"paplorinc@yahoo.com","avatar":null},"body":">> Hello! :)\n>>\n>> We are working in parallel on the refactoring of a\n>> small project. The team uses SVN and I decided to give GIT a chance to\n>> demonstrate it's merging capabilities I've read so much good about :).\n>>\n>> However\n>>  - I must be doing something VERY wrong - every time I try to merge from\n>>  the remote svn (git svn fetch and git merge remotebranch) into my\n>> branch, I get hundreds of conflicts, mostly because of moved folders.\n>\n>Google is your friend\n>\n>https://wiki.kuali.org/display/KULRICE/git-svn+how+to\n>\n>http://flavio.castelli.name/howto_use_git_with_svn\n>\n>http://viget.com/extend/effectively-using-git-with-subversion\n>\n>http://java.dzone.com/articles/how-start-using-git-svn-based\n>-- \n>David\n\nI have no idea why you guys think I'm an idiot.\nI have read every link I could find (most of the Pro Git book and watched several hours of git video tutorials). The problem is not with GIT-SVN, it's with the GIT merge, more specifically with a simultaneous modify and move, which conflicts probably because it is detected as a modify and delete.\nCould someone please be a little more friendly, I need advice on how to solve hundreds of git merge conflicts (eg. parallel move and modify, which should have been merged automatically).\n\nThanks,\nLőrinc\n"},{"id":"189072","messageId":"CAH5451myTL94j5T01vLkfRzf_bh2B_YPehvberr05uMdFyZdPw@mail.gmail.com","threadId":"30212","inReplyTo":"1334208237.82681.YahooMailNeo@web160606.mail.bf1.yahoo.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2012-04-12T05:41:24Z","receivedAt":"2012-04-12T05:41:24Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"2012/4/12 Pap Lôrinc <paplorinc@yahoo.com>:\n>>> Hello! :)\n>>>\n>>> We are working in parallel on the refactoring of a\n>>> small project. The team uses SVN and I decided to give GIT a chance to\n>>> demonstrate it's merging capabilities I've read so much good about :).\n>>>\n>>> However\n>>>  - I must be doing something VERY wrong - every time I try to merge from\n>>>  the remote svn (git svn fetch and git merge remotebranch) into my\n>>> branch, I get hundreds of conflicts, mostly because of moved folders.\n>>\n>>Google is your friend\n>>\n>>https://wiki.kuali.org/display/KULRICE/git-svn+how+to\n>>\n>>http://flavio.castelli.name/howto_use_git_with_svn\n>>\n>>http://viget.com/extend/effectively-using-git-with-subversion\n>>\n>>http://java.dzone.com/articles/how-start-using-git-svn-based\n>>--\n>>David\n>\n> I have no idea why you guys think I'm an idiot.\n> I have read every link I could find (most of the Pro Git book and watched several hours of git video tutorials). The problem is not with GIT-SVN, it's with the GIT merge, more specifically with a simultaneous modify and move, which conflicts probably because it is detected as a modify and delete.\n> Could someone please be a little more friendly, I need advice on how to solve hundreds of git merge conflicts (eg. parallel move and modify, which should have been merged automatically).\n>\n> Thanks,\n> Lőrinc\n>\n\nCould you perhaps show us what commands you have tried, and what the\nconflicts look like?\n\nRegards,\n\nAndrew Ardill\n"},{"id":"189073","messageId":"20120412054155.GB27369@sigill.intra.peff.net","threadId":"30212","inReplyTo":"1334160803.74554.YahooMailNeo@web160603.mail.bf1.yahoo.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-04-12T05:41:55Z","receivedAt":"2012-04-12T05:41:55Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 11, 2012 at 09:13:23AM -0700, Pap Lôrinc wrote:\n\n> I think the \n> problem arises because git doesn't track\n>  moves, therefore I constantly get conflicts of type \"local modified, \n> remote deleted\" (or even both deleted) when in fact it was only modified\n>  and moved, it could have been merged without conflicts (-> apply my \n> changes and move the file to the new location).\n\nGit does rename detection at the time of merge, and will apply changes\nto the destination file. I'm not sure why this isn't working for you.\nSome theories:\n\n  1. Git may give up on finding renames if it is very computationally\n     expensive. It will print a warning in that case, but you may miss\n     it in the output. You might try:\n\n        git config merge.renamelimit 0\n\n     to turn off the limiting.\n\n  2. Do your files actually look like renames? Git's inexact rename\n     detection looks at the file content, and correlates removed and\n     added files that have a high percentage of similar content. If most\n     of the file ended up changed, then the pair is not considered a\n     rename.\n\n-Peff\n"},{"id":"189074","messageId":"CAFfmPPMbr-db+OnTwK-ry+wGQSEeunsD+QrmAVS2fzDH+hGnbg@mail.gmail.com","threadId":"30212","inReplyTo":"1334208237.82681.YahooMailNeo@web160606.mail.bf1.yahoo.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-04-12T05:49:25Z","receivedAt":"2012-04-12T05:49:25Z","isPatch":false,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"On Thu, Apr 12, 2012 at 3:23 PM, Pap Lôrinc <paplorinc@yahoo.com> wrote:\n>>> Hello! :)\n>>>\n>>> We are working in parallel on the refactoring of a\n>>> small project. The team uses SVN and I decided to give GIT a chance to\n>>> demonstrate it's merging capabilities I've read so much good about :).\n>>>\n>>> However\n>>>  - I must be doing something VERY wrong - every time I try to merge from\n>>>  the remote svn (git svn fetch and git merge remotebranch) into my\n>>> branch, I get hundreds of conflicts, mostly because of moved folders.\n>>\n>>Google is your friend\n>>\n>>https://wiki.kuali.org/display/KULRICE/git-svn+how+to\n>>\n>>http://flavio.castelli.name/howto_use_git_with_svn\n>>\n>>http://viget.com/extend/effectively-using-git-with-subversion\n>>\n>>http://java.dzone.com/articles/how-start-using-git-svn-based\n>>--\n>>David\n>\n> I have no idea why you guys think I'm an idiot.\n> I have read every link I could find (most of the Pro Git book and watched several hours of git video tutorials). The problem is not with GIT-SVN, it's with the GIT merge, more specifically with a simultaneous modify and move, which conflicts probably because it is detected as a modify and delete.\n> Could someone please be a little more friendly, I need advice on how to solve hundreds of git merge conflicts (eg. parallel move and modify, which should have been merged automatically).\n\nHi Pap,\n\nI think I understand the issue you are facing.\nI assume that your collaborators are following the practice of\none-commit-per-factor-operation.\nMy experience with this has been that synchronizing work best if\nchanges are \"bubbled up\".\nI did this by progressively rebasing my branch against each upstream commit.\nI hope this helps a little.\n\n--\nDavid Barr\n"},{"id":"189101","messageId":"1334238768.18499.YahooMailNeo@web160601.mail.bf1.yahoo.com","threadId":"30212","inReplyTo":"CAFfmPPMbr-db+OnTwK-ry+wGQSEeunsD+QrmAVS2fzDH+hGnbg@mail.gmail.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"Pap Lôrinc","fromEmail":"paplorinc@yahoo.com","sentAt":"2012-04-12T13:52:48Z","receivedAt":"2012-04-12T13:52:48Z","isPatch":false,"sender":{"key":"paplorinc@yahoo.com","avatar":null},"body":"Thank you all for the answers! :)\n\n\nI have already set the rename limit to 0, and upon committing and fetching the renames are calculated and found.\n\n\nThe commands are (I use tortoise git now, but tried the console and other GUIs, as I said in my first post) \"git svn fetch\" and \"git merge remoteBranch\".\nI figured now, that this was the problem, I should have used rebase instead of merge (I still don't understand why merge doesn't work, but rebase and conflict resolution with a GUI (where I can resolve more files at once) seems acceptable). Thanks David! :)\n\nLőrinc\n"},{"id":"189116","messageId":"CAPZPVFbBPXzTaY5rAqs8NMWMaepo_pmB6-skDL-=VbOHzUz55A@mail.gmail.com","threadId":"30212","inReplyTo":"1334238768.18499.YahooMailNeo@web160601.mail.bf1.yahoo.com","subject":"Re: Parallel refactoring and git merge nightmare","fromName":"Eugene Sajine","fromEmail":"euguess@gmail.com","sentAt":"2012-04-12T16:03:17Z","receivedAt":"2012-04-12T16:03:17Z","isPatch":false,"sender":{"key":"euguess@gmail.com","avatar":null},"body":"On Thu, Apr 12, 2012 at 9:52 AM, Pap Lôrinc <paplorinc@yahoo.com> wrote:\n> Thank you all for the answers! :)\n>\n>\n> I have already set the rename limit to 0, and upon committing and fetching the renames are calculated and found.\n>\n>\n> The commands are (I use tortoise git now, but tried the console and other GUIs, as I said in my first post) \"git svn fetch\" and \"git merge remoteBranch\".\n> I figured now, that this was the problem, I should have used rebase instead of merge (I still don't understand why merge doesn't work, but rebase and conflict resolution with a GUI (where I can resolve more files at once) seems acceptable). Thanks David! :)\n>\n> Lőrinc\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\nAs an addition I would recommend to be a little more strict about how\nrefactoring is committed:\nI.e. split up the repackaging and actual code refactoring - as a rule\nwe are committing renames separately from other changes or with\nminimal changes (like package change for java classes)\nThen i would use the rebase if there is some parallel work as suggested above\n\nHope that helps,\nEugene\n"}]}