How to Branch and keep the branch history with TFS 2013 - visual-studio-2013

I need to create a branch in TFS and copy the code and the history from the parent branch.
I am using TFS 2013 with Visual Studio 2013, is there a way to easily do this ?

Branching is a technique for creating a parallel set of versions of your files. So the branch will have the same codebase as parent branch.
Regarding the history, the file will keep the history under the branch change, check the screenshot below:

Related

How do I change the branch I am currently developing for in Team Foundation Server and Visual Studio 2013?

I am using Visual Studio 2013 on a project with Team Foundation Server. I created a new branch, but when I click "Get Latest Version", I get the latest version from the old branch, not the new branch, and when I commit changes, the changes are made to the old branch. How can I change the current branch in Visual Studio 2013 so I can develop on the new branch?
It sounds like you're using TFVC. Branches in TFVC are represented in different folders in the source control explorer and in your file system.
If you want to make changes on a branch, open the solution file from the appropriate branch. If it's not in your file system, map a workspace to the appropriate branch.

Visual Studio Merge Changes In Merge Tool Missing

I taken branched from master branch. While I work on branch, other developers worked on master branch. While merge operation branch to master branch, i saw multiple conflicts. I wanted manual merge but missing "Merge Changes In Merge Tool". There are just Keep Target Branch Version and Take Source Branch Version buttons. What can i do for issue?
PS : This issue, there are just .cs files.
If it's only for .cs files merging would probably been disabled.
In Visual Studio go to Team Explorer > Settings
Under section Team Project Collection > Source Control you can manage file extensions an the enabling of file merging.

How to convert a deleted regular directory into a branch in TFS?

I'm in the middle of migrating a repository from TFS to Git, and I'm using git-tfs.
I've already converted my Trunk branch using 'git tfs clone ...' successfully. When trying to 'git tfs branch --init' a related branch it fails with the error message: 'error: TFS branches $/foo/myrelatedbranch not found!'
This seem to be caused by the $/foo/myrelatedbranch no being a proper tfs branch. The 'branch' documentation (https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md) seem to be pretty clear on the related branch having to be a PROPER branch (https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md#merge-changesets-and-branches).
The branch $/foo/myrelatedbranch has been deleted a while back, so I'm not able to see the option 'Branching and Merging -> Convert to Branch' in the Source Control Explorer.
Is there any way of making this deleted directory a proper branch in TFS?
Using Visual Studio 2015 and TFS 2015
You can configure the Source Control Explorer to show deleted items:
From the menu bar choose Tools, Options.
On the Options dialog box, navigate to Source Control, Visual Studio Team Foundation Server.
Select Show deleted items in the Source Control Explorer, and then choose OK.
If you now open the Source Control Explorer, you can view the deleted folder and convert the folder to a branch.
You can also rollback the changeset that deleted the folder. The rollback will create a new changeset where the changes are negated (so in this case, where the folder is added).
If the problem still exists, you could just take a snapshot of the latest version and migrate that to Git.

Git with TFS and exclusive checkouts

I would like some advice on how to use Git locally on my computer along with Visual Studio and a TFS server. Unfortunately the technical leader of my company has set TFS with the exclusive check-out policy and so every time someone checks out a file, it can't be edited by someone else.
What is the right way to make the two systems live together? I would try to use Git-TF but I'm not convinced with the checkin phase. The workflow should be as the following:
clone the project
switch to offline mode for Visual Studio
work offline with Git
fetch from the TFS server and rebase
check-in?
The problem is: how do I check-in my files if someone else has already checked out the files I need to change? How does Git-TF really work when checking-in files?
Another workflow that came to my mind, without Git-TF, could be the following:
open the TFS project
switch to offline mode
create a new branch with Git
work on the branch
return to the master branch, update it
exclusively checkout the files which have been changed on my Git branch
merge the branch on master
check in with TFS (after switch to online mode?)
What do you recommend?

Is there a way in VS 2010 with TFS 2008 to check in your changes as a new branch?

My question is rather simple I have made many changes in our project which I don't want to merge with the main branch right away. I did not take a branch at the start of these changes while I was making them. So now I tried to find a way to take branch to check in my code but there does not seem to be a solution. How can I do this and what is the best approach to take. I am using Visual Studio 2010 which connects to TFS 2008.
Thanks a lot.
You could create a new branch now and then change the paths on your edited files to the new branch before checking them in.
Create a new branch.
Shelve your pending changes.
Use the power tools to move the shelved changes from the current branch to your new branch using the following command.
tfpt unshelve [MY_SHELVESET_NAME] /migrate /source:CURRENT_BRANCH_PATH /target:NEW_BRANCH_PATH
Take a look at the powertools help to get further details.

Resources