{"thread":{"id":"13648","subject":"Unhelpful git-rebase error when untracked files conflict with new head","startedAt":"2008-05-24T00:07:04Z","lastAt":"2008-05-24T00:07:04Z","messageCount":1,"participants":["Steven Grimm"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"77624","messageId":"3E16F335-153D-4E60-85D8-00CF9E5BD1F3@midwinter.com","threadId":"13648","inReplyTo":null,"subject":"Unhelpful git-rebase error when untracked files conflict with new head","fromName":"Steven Grimm","fromEmail":"koreth@midwinter.com","sentAt":"2008-05-24T00:07:04Z","receivedAt":"2008-05-24T00:07:04Z","isPatch":false,"sender":{"key":"koreth@midwinter.com","avatar":"https://gravatar.com/avatar/71b4d2e8b62f168bdc9e9205341159e3567003b4f9e2127c617c5fa0a1f5bad2?d=mp&s=160"},"body":"Just helped someone figure out what was going on with a rebase  \nfailure. The error message from git-rebase is pretty confusing and  \nunhelpful when there's a conflicting untracked file in the working  \ncopy. Example:\n\n[ create a repo with 1 commit and 1 file ]\n$ mkdir parent\n$ cd parent\n$ git init\nInitialized empty Git repository in .git/\n$ touch foo\n$ git add foo\n$ git commit -m 'initial commit'\nCreated initial commit 97aef94: initial commit\n  0 files changed, 0 insertions(+), 0 deletions(-)\n  create mode 100644 foo\n$ cd ..\n\n[ clone it and create a second file in both parent and child,  \ncommitting it in parent ]\n$ git clone parent child\nInitialized empty Git repository in /home/koreth/test/child/.git/\n$ touch parent/bar child/bar\n$ cd parent\n$ git add bar\n$ git commit -m 'second commit'\nCreated commit 40d4be0: second commit\n  0 files changed, 0 insertions(+), 0 deletions(-)\n  create mode 100644 bar\n\n[ try to rebase to the parent's second commit in the child ]\n$ cd ../child\n$ git fetch\nremote: Counting objects: 3, done.\nremote: Compressing objects: 100% (2/2), done.\nremote: Total 2 (delta 0), reused 0 (delta 0)\nUnpacking objects: 100% (2/2), done.\n From /home/koreth/test/parent/\n    97aef94..40d4be0  master     -> origin/master\n$ git rebase origin/master\nFirst, rewinding head to replay your work on top of it...\ncould not detach HEAD\n\n\"could not detach HEAD\" tells you basically nothing about what's going  \non. I spent a fair while scratching my head over this, because I was  \nperfectly able to detach HEAD by hand (checking out old revisions,  \netc.) It would be more accurate to say, \"Could not check out the  \nrevision you're rebasing onto.\"\n\nIf you run git-rebase under strace, there actually *is* a meaningful,  \nhelpful error message being generated by \"git checkout\":\n\n...\n[pid 11353] write(2, \"error: Untracked working tree file \\'bar\\' would  \nbe overwritten by merge.\\n\", 72) = 72\n...\n\nbut it gets discarded rather than shown to the user.\n\nAre we suppressing output from git-checkout intentionally? Are there  \nspecific error messages other than this one that we don't want to show?\n\n-Steve\n"}]}