37

I am follwing the example here Branch from local workspace because I have the same scenario.

Shelveset details dialog appear, after clicking unshelve it showing "An item with the same key has already been added."

Any advice please?

3
  • 10
    Solved by Undo pending changes from Main as well. Here's help link. lemisolutions.co.nz/2013/07/…
    – NetZeroSaw
    Commented Jul 24, 2013 at 4:41
  • 2
    could you accept an answer, since people have put the effort into your question? Commented Nov 30, 2014 at 11:46
  • 1
    @RalphWillgoss It seems he solved it himself on 24-Jul-2013 itself! Other answers (later in 2014) seems to be similar to his comment.
    – Sen Jacob
    Commented May 29, 2017 at 9:50

3 Answers 3

33

As others have indicated in the comments, undoing changes from the main branch (presumably the SOURCE branch for the shelveset you want to unshelve), should fix the issue, allowing you to continue with the merge behavior.

2
  • 10
    In fact you need to undo / shelve changes from other repositories. The included / excluded / add sections should be completely empty for this to work.
    – Gabriel
    Commented Mar 19, 2015 at 23:27
  • 2
    @Gabriel's comment is vital. If you have any file in Include / Excluded / Add, from any part of the team project, you will get this error. Strange but true.
    – ngm
    Commented Dec 8, 2016 at 15:05
5

I had a very similar issue to yourself and after trying a lot of things I discovered it was some pending changes we had been excluded and were easy to miss, that caused the issue.

I've written up how to trouble shoot it against the following question:
TFS 2012 Unshelve to different branch -> An item with the same key has already been added

1

In my case, my source and my target branch were both fully checked in. The problem was the root Team Project had other Visual Studio projects beneath it with pending changes (pending adds). There can be no pending changes in the entire TFS Team Project, not just the involved project branches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.