Branch from local workspace

我是研究僧i 提交于 2019-11-28 18:44:23

问题


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:


  1. Download and install TFS Power Tools
  2. Shelve your work and remember the name
  3. Create your destination branch from the trunk you've been working in
  4. Map your new branch and get a local copy of the code
  5. Open Windows PowerShell and change to the directory of the original source code
  6. 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.

  1. Open the project in work-space and right click on it
  2. you will notice "Team" in the menu.
  3. select "Share Project" in the extended menu of "Team"
  4. 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.

  5. Share the project in the selected branch/folder.

(THIS IS JUST ADDING PROJECT TO TFS-YOU NEED TO CHECKIN NOW)

  1. right click on the project again. in the "Team" menu you will find checkin changes option.
  2. click on it and your changes will be sent to Server.

Cheers!



来源:https://stackoverflow.com/questions/3728318/branch-from-local-workspace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!