{"thread":{"id":"14225","subject":"error: Untracked working tree file '(myfile)' would be overwritten by merge. when checking out a more recent branch","startedAt":"2008-06-30T10:15:56Z","lastAt":"2008-06-30T10:15:56Z","messageCount":1,"participants":["Swanny Lorenzi"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"81739","messageId":"4868B25C.1030005@over-blog.com","threadId":"14225","inReplyTo":null,"subject":"error: Untracked working tree file '(myfile)' would be overwritten by merge. when checking out a more recent branch","fromName":"Swanny Lorenzi","fromEmail":"swanny@jfg-networks.net","sentAt":"2008-06-30T10:15:56Z","receivedAt":"2008-06-30T10:15:56Z","isPatch":false,"sender":{"key":"swanny@jfg-networks.net","avatar":null},"body":"Hi,\n\nWe got at work a surprising error when trying to checkout a more recent \nbranch :\nerror: Untracked working tree file '(file)' would be overwritten by \nmerge. (I replaced the actual file name by 'file' in this mail)\n\nThe context is :\n- Each developer has its own git repository, and makes all developement \nwork in it\n- We use a \"central\" git repository to gather all our work, all devs \ntrack this common repository's branches to pull and push they work.\n- We don't allow devs to track another dev branch, everything must pass \nby this central repository.\n- We use git v 1.5.5.4, tig and git gui.\n- Our main branch is called \"trunk\", and we use several other branches \nfor our work.\n\n\nLast Thursday, I had to replace 6 directories (with files in them) by \nsymbolic links to another directory, in the \"trunk\" branch.\nI removed them using sh rm -rf, then ln -s to create the links. Problem, \ngit gui failed to stage the changes to a single commit.\nI split the change into 2 operations : the directory removal -> commit, \nthen the symlink creation -> commit.\nI pushed the 2 commits - and other commits after - into our central \nrepository, no error was prompted.\n\nThen came the issue :\nEach time a dev tried to checkout the trunk branch from an older version \n(e.g. a branch that has its origin to an older commit of trunk), he got \nthe error message\nerror: Untracked working tree file '(file)' would be overwritten by merge.\n=> Checkout failed, etc. Obliged to force the checkout with git checkout -f.\n\n- The file listed in the error message is absolutely not affected by any \ncommit in the 2 I mentioned above, nor in the 10 surrounding them. It \nwas not even changed for 2 monthes.\n- The error occur even if we don't have any \"modified\" file (git status \nanswers nothing to commit, nor any untracked files)\n- After investigations, it seems that the error occurs each time we ask \ngit to run the 2 commits mentioned above in a single checkout command : \nIf I checkout a branch pointing to the 1st commit (dir deletion), then \nanother checkout to the trunk head, the error does not occur.\n- The file mentioned in the error is the first file in the directory \nthat follow the parent dir of the removed dirs (in the order returned by \nls):\n\n- I failed to reproduce this bug using clean repositories...\n\nHas anyone got this error before ?\nIs it a git bug ?\n\nThanks for all\n\nSwanny\n"}]}