问题
I was developing team project and suddenly realised that i've made so many changes, that i need create branch.
I've never used branching in TFS and when i saw "Branch\ "From Workspace version" i thought that's, what i need. But this option doesn't act as i supposed.
How can i create new branch, from my "LOCAL COPY of Project" and include all local changes"? The option that I mentioned above creates something like branch from...i don't know exacly from what, but i know for sure, that not from my local version with all changes. As i noticed, generated branch doesn't have files and project which i added.
回答1:
What I would do is:
- Shelve your work
- Branch from the appropriate source folder
- Use TFS Power Tools to unshelve to a different location
- Check in.
That way, you get a nice clean branch, and you get a record of the changes you have made.
回答2:
- Download and install TFS Power Tools
- Shelve your work and remember the name
- Create your destination branch from the trunk you've been working in
- Map your new branch and get a local copy of the code
- Open Windows PowerShell and change to the directory of the original source code
Run the following command replacing the Shelve set name and directory structure with your own:
tfpt unshelve /migrate "MyShelveset" "/source:$/project/trunk" "/target:$/project/branch"
(quotes around shelveset name are required if it contains spaces)
This should help you avoid some of the problems I ran into when I was trying to follow the original instructions.
回答3:
Robaticus's answer is correct, but I wish to add some detail that I haven't seen explicitly stated elsewhere. I just had to do this and it acted like it was working but it wasn't. It would pretend to automerge or copy, but no files were created, and no checkouts were made in the new branch. An error should be raised, but none appears.
It turns out that the quotes around the source and target are optional if the paths have no spaces, but they are required if spaces exist.
Here's a template:
tfpt unshelve MyShelfsetName /migrate "/source:$/MyPath/My Path with spaces/MyBranch" "/target:$/MyPath/My Path with spaces/MyOtherBranch"
回答4:
You may want to try this one: I am assuming you are using Eclipse IDE and TFS Plugin. You need to be a TFS Administrator for the project.
- Open the project in work-space and right click on it
- you will notice "Team" in the menu.
- select "Share Project" in the extended menu of "Team"
enter team Foundation Server details to connect it and select the appropriate Branch/Project to put your changes. You can also create a new folder by TFS Control Panel.
Share the project in the selected branch/folder.
(THIS IS JUST ADDING PROJECT TO TFS-YOU NEED TO CHECKIN NOW)
- right click on the project again. in the "Team" menu you will find checkin changes option.
- click on it and your changes will be sent to Server.
Cheers!
来源:https://stackoverflow.com/questions/3728318/branch-from-local-workspace