{"thread":{"id":"35818","subject":"Rebase fail with new file","startedAt":"2014-02-06T20:11:34Z","lastAt":"2014-02-06T20:11:34Z","messageCount":1,"participants":["Lee Carver"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"234394","messageId":"CABpzZJRzku4xJyg1t1E4sJJee9_qwq0+jYpo34Hdxi2fXOLKdA@mail.gmail.com","threadId":"35818","inReplyTo":null,"subject":"Rebase fail with new file","fromName":"Lee Carver","fromEmail":"leeca@pnambic.com","sentAt":"2014-02-06T20:11:34Z","receivedAt":"2014-02-06T20:11:34Z","isPatch":false,"sender":{"key":"leeca@pnambic.com","avatar":null},"body":"GitDev -\n\n\nDuring a rebase of a feature branch to the master branch, I lost a new\nfile in a new directory.  I was able to recover by replaying the\nrebase and taking exceptional actions.  However, I'm left with the\nimpression the git does not handle new files properly under some\nrebase situations and gives the wrong advice to users.\n\n\nI was able to recover by reseting the branch to the pre-rebase commit,\nrepeating the rebase, and manually applying the\n.git/rebase-apply/patch at the critical point.  I do not understand\nwhy the patch did not work through the rebase command.\n\n\nAdditionally, the git recommendation that after the failed patch, with\nno local changes, a [git rebase --skip] is a likely resolution is just\nwrong.  Skipping after a complete patch failure lead me to very broken\nworking directory.\n\n\nDetails follow, and the contents of the problematic commit are\nattached (from [git show 2e9b460]).\n\n\nThanks\n\n   Lee\n\n\nThis occurs with git version 1.8.3.2\n\n\n[1024] $ git --version\n\ngit version 1.8.3.2\n\n\n*** Details ***\n\n\nInitial setup:  After working in branch feature/build-projects for\nseveral days (with ~21 commits+pushes from branch point), I needed to\nintegrate new changes from the master branch.  Here are the steps from\nmy bash history:\n\n\n  879  git checkout master\n\n  880  git pull\n\n  881  git checkout feature/build-projects\n\n  882  git rebase master\n\n\nThere were a couple of conflicts, which I resolved and moved on with\n[git rebase --continue].\n\n\nAt approximately the 14th commit, the rebase stopped with this message:\n\n\n<bash>\n\n\nApplying: STRY0057770: Add -Z parent for late build modules.\n\nUsing index info to reconstruct a base tree...\n\nFalling back to patching base and 3-way merge...\n\nerror: Your local changes to the following files would be overwritten by merge:\n\nglide-app-itbm/pom.xml\n\nPlease, commit your changes or stash them before you can merge.\n\nAborting\n\nFailed to merge in the changes.\n\nPatch failed at 0014 STRY0057770: Add -Z parent for late build modules.\n\nThe copy of the patch that failed is found in:\n\n   /Users/lee.carver/Service-now/dev/glide04/git/glide/.git/rebase-apply/patch\n\n\nWhen you have resolved this problem, run \"git rebase --continue\".\n\nIf you prefer to skip this patch, run \"git rebase --skip\" instead.\n\nTo check out the original branch and stop rebasing, run \"git rebase --abort\".\n\n</bash>\n\n\n\nGit status indicated no change, and inspection of the\nglide-app-itbm/pom.xml showed no conflicts or unexpected content:\n\n\n<bash>\n\n[888] $ git status\n\n# HEAD detached from ee6d51c\n\n# You are currently rebasing branch 'feature/build-projects' on 'ee6d51c'.\n\n#   (all conflicts fixed: run \"git rebase --continue\")\n\n#\n\n\nWhen I tried to  [git rebase --continue], the error message provided a\nlittle more information.  Specifically, it mentions the added (new)\nfile glide-module-parent-z/pom.xml.\n\n\n[904] $ git rebase --continue\n\nApplying: STRY0057770: Add -Z parent for late build modules.\n\nApplying: STRY0057770: Provide version properties for diagrammer and\nemail-notification.\n\nUsing index info to reconstruct a base tree...\n\nM glide-app-itbm/pom.xml\n\nA glide-module-parent-z/pom.xml\n\nFalling back to patching base and 3-way merge...\n\nAuto-merging glide-module-parent/pom.xml\n\nAuto-merging glide-app-itbm/pom.xml\n\nCONFLICT (content): Merge conflict in glide-app-itbm/pom.xml\n\nFailed to merge in the changes.\n\nPatch failed at 0015 STRY0057770: Provide version properties for\ndiagrammer and email-notification.\n\nThe copy of the patch that failed is found in:\n\n   /Users/lee.carver/Service-now/dev/glide04/git/glide/.git/rebase-apply/patch\n\n\nWhen you have resolved this problem, run \"git rebase --continue\".\n\nIf you prefer to skip this patch, run \"git rebase --skip\" instead.\n\nTo check out the original branch and stop rebasing, run \"git rebase --abort\".\n\n</bash>\n\n\n\nI made a minor edit to the glide-app-itbm/pom.xml (adding a \"-z\" to\nthe parent name), [git add -u], and then [git rebase --continue].\n\n\nThere were a couple of addition conflicts, some resolved with\n--continue, some with --skip.\n\n\nIn the end, I was left with a working direction that did not contain\nthe new file glide-module-parent-z/pom.xml or other changes from the\nproblematic commit/rebase step (STRY0057770: Add -Z parent for late\nbuild modules.).\n\n\n*** Recovery ***\n\n\nI was able to recover the branch, and complete the rebase with the\nexpected results only by manually applying the patch file at the\ncritical rebase step:\n\n\nStarting in the feature branch, these actions were performed:\n\n\n  928  git reset --hard 6793d9f\n\n  930  git checkout master\n\n  931  git pull\n\n  932  git checkout feature/build-projects\n\n  934  git rebase master\n\n\nWhen the rebase of (STRY0057770: Add -Z parent for late build\nmodules.) stopped, I manually applied the patch\n\n\n  959  git apply .git/rebase-apply/patch\n\n\nWith the appropriate adds, etc. I was able to [git rebase --continue]\nto a successful conclusion.\n"}]}