I made changes to a lot of files, and in the meantime I figured I rather commit this untested code to a yet-to-be-created branch, so that users of the existing code base are not affected.
As I touched really many, many files and created and added new sub-projects etc., I want to avoid copying files and folders manually.
What's the easiest way to get this done in Visual Studio?
This functionality is provided using tfpt unshelve /migrate. To use it, follow these steps:
Create a shelveset of your changes (from the UI, or tf shelve . /R)
Create the new branch
Download and install the Team Foundation Server Power Tools
From a Visual Studio Command Prompt, run the following command: tfpt unshelve /migrate /source:$/TeamProject/Main /target:$/TeamProject/Beta
This will essentially re-write the paths in your shelveset to the new branch.
Related
I came from Eclipse background and I am apparently missing something.
There is an existing GitHub project with JS code in it and I would like to start adding TypeScript nature to it, one type at a time.
I have followed this tutorial to clone project from GitHub to my "local git repository". Now the Team Explorer window displays it as local repository and I can commit changes etc but it's not a project and I don't know how to open it as a project (I want to open it as TypeScript project).
The workflow I was used to from Eclipse would simply be New -> Other -> SVN -> Checkout Projects from SVN that is automatically followed by New Project Wizard.
How do I clone existing JS project from GitHub and make it a TypeScrip project while keeping the existing folder structure?
EDIT: I am using Visual Studio Express and I am limited to the native Git extension.
What I typically do in this situation;
Clone repository using Git in Visual Studio; or use GitHub for Windows and Clone in Desktop from the Git project's web page. This will create a directory (repository) with the project files where you specify.
In visual studio, File->New->create a new project from existing code. From the wizard, select C# or C++ (whatever your choice it does not really matter)
The wizard requires a project file location: give the location of the Git folder that contains the project files (where you cloned the project's repository).
The Wizard requires a unique project name, for example you can use the name of the Git project with VisualStudio (or VS) appended to the end.
Git will now be in sync and you will be able to see all the git files. Making changes will check them out and allow you to push them to the project etc...
***** By default Git will want to check in the newly created .csproj file that Visual Studio creates to allow you to open the project in Visual Studio. You will just want to drag this into the excluded changes section because most likely the project in question will not be using Visual Studio.**
I solved this by opening the site as a website. File->Open->Website.
No Project Files/Solution files required. It just opens up the folder in the solution explorer.
To make it a typescript project, just add a tsconfig.json file to the directory.
Do you have any code in that repository yet that you want to open? I'm guessing not in which case you need to create a new VS project (just like you'd create a new Eclipse project and have it in your workspace)
Go to File, New..., Project... and pick the project type that you want. Give the project a name and set the location to be a folder INSIDE the folder that you cloned your Git repo to earlier (i.e. c:\mycode\mygitproject). Also give your solution a name. A "Solution" in Visual Studio is a wrapper for the projects inside it, kinda like the closest thing to a workspace or a working set in Eclipse but not quite the same thing.
Then Visual Studio should then be smart enough to pick up that this is in Git repo and allow you to commit locally as well as push/pull to GitHub etc.
Finally, while I work with the team that created the Visual Studio Tools for Git, I'd still highly recommend that you get hold of a command line should you want to do some more powerful stuff with Git other than simply committing code, push/pulling changes and branching or merging branches. If you are working against GitHub then you might also want to install GitHub for Windows which will bring some Git tools with it or you can install Git for Windows and also install Posh-Git separately. All of these things work together and give you the maximum power of Git but you can pick and choose the tool that works best for you. You'll probably find a workflow of Clone using GitHub for Windows, commit/push/pull/branch/merge in VS and then Posh-Git if you do more advanced stuff or want to hand-tweak settings.
We are experimenting to use Microsoft Team Foundation Server Source Code Control as a replacement for SVN.
Therefore, it would be great if the friction for this transition would be minimal.
For example, in SVN, whenever I create new files in the folder, and then use "Tortoise SVN Check for Modifications", I get a master list of Added Files, Deleted Files, and Edited Files.
I know that in TFS SCC in Visual Studio, the equivalent is the Pending Changes Panel. However, this panel only lists Edited Files. How can I get new files listed in that panel, too, just like SVN does?
The workflow really depends on whether you are using Local Workspaces or the traditional Server Workspaces. As you are coming from SVN, Local Workspaces would probably be a good fit.
Local Workspaces (New to TFS 2012)
Local Workspaces are TFS's attempt at DVCS and actually gives you a much more SVN-Like experience. The pending changes window with local workspaces is divided up into the following areas:
Included Changes - This is effectively files that are already in Source Control that have been changed.
Excluded Changes - These are all files within the workspace that are not in source control. This is like your Added files in SVN.
Server Workspaces
Server Workspaces are the traditional TFS workspace approach. An item is not in Source Control until it is explicitly added.
There is a much more detailed article on the differences here: http://msdn.microsoft.com/en-gb/library/bb892960.aspx
Drag and drop your new files into the right folders in the Source Control Explorer in Visual studio and then there will be asked if there are also files that need to be excluded from the source control. If that is done they are in the Pending changes window. The implementation like SVN is starting from Visual studio 2012 but then still it can give issues and not be in that panel.
I see this is an old question but I believe the answer is in Visual Studio's "Pending Changes Panel" itself. Notice the "Excluded Changes (nnn)" section. Just below that heading you should find "Detected: nnn add(s)". You can see your 'new files' listed there.
For what it's worth, I find the "Pending Changes" an unwieldy feature in that it seems it's never context aware. I find that I often have to "weed through" many, many files that are simply not relevant to the solution/project(s) at hand.
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?
I am trying to perform a complicated merge between branches of the same solution. We use Team Foundation Server, but I would prefer compare folders locally with WinMerge instead of relying on TFS directly to tell me what changed. The problem is, there are a lot of files that are not in source control which pollute the WinMerge folder comparison: bin, obj, static code analysis files, remaining projects that were created locally but discarded and never deleted...
I could delete local folders and force get from source control to clean it, but I'm connected to the source control through a slow VPN and it could take a while; or I could also manually delete whichever files I think are duplicate, but that is too empirical to be exhaustive.
So here's my question: is there any tfs command to clean local folders?
In 2015 tfpt has since been deprecated. After downloading the 2015 TFS Power Tools the new command is:
tf reconcile /clean /recursive .
The ending dot assumes your Developer Command Prompt is sitting at the root directory in your workspace you wish to start from, and /recursive assumes you want to include all subdirectories.
When you run the command it will pop up a preview of all changes it will make, and give you the opportunity to cherry-pick which ones you'd like to keep, if not all.
Note: pending files will not be included in the results, which is usually what you want. If you want to remove them as well, you should undo your pending changes first.
You can use the:
tfpt scorch
..command for this purpose. the TFPT command line is part of the TFS Power Tools
For Visual Studio 2017, there is no Power Tools but the good news is that most of the features are moved into TFS 2017. Therefore, you can simply use the following without installing any tools.
tf vc reconcile /clean /recursive .
No, there is no command. As far as the version control doesn't know about the files that are not added to the version control, it cannot delete them.
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.