Team Foundation Version Control - Easiest Way to Overwrite Remote Changes - tfs

A co-worker of mine overwrote some my changes by mistake in good number of files in a folder (basically he had no changes in those files, just pushed older version of the files from his machine). I'm new on the project that uses TFVC. What will be the easiest way for me to overwrite those files. Some of these files have some new changes that are still on my machine and some have no new changes.
Please advise.
Thank you!

I think the best approach would be to ask your colleague to revert his changeset.

Related

How can I migrate files to another branch without checking them in?

tfpt.exe is not exist anymore from VS 2017 and beyond. So how can I move files from one branch to another without checking them in. Say I've accidentally written code in the wrong branch or I'm told to move my change to a different version before checking in. This happens all the time. If there is not a way to do this, then either TFS is broken or I'm using it wrong.
This no longer works:
tfpt unshelve /migrate /source:"$/MyProject/DevCurrent/DevMain" /target:"$/MyProject/DevNext/DevMain" "Temp"
Please don't mark this question as duplicate without making sure it actually is. I've been researching this all day, and there have been 15 million different ways of doing this over the past ten years none of which work on modern tooling.
I need a solution for TFS 2018 and Visual Studio 2017. I do not have control over these versions.
After I had the same problem with VS2019, my best way to to it was to copy/paste the modified source folder to the branch target folder and use
tf reconcile /promote
to detect all added or changed files.
This happens all the time.
Why? it shouldn't happens all the time. check where you are and then start coding.
I've been researching this all day
So I guess you see this question, if the answers there not good for you, let me suggest a simple way to do that, but it's manual way and not just run a command:
1) You change a file and suddenly you put attention that you are in the wrong branch.
2) You don't want check-in the changes to the wrong branch.
3) In the past you put the file in Shelveset and then tfpt ..., but now the command no longer exist.
3) No problem. Go to your local folder, copy the file (with the changes).
4) Go to the correct branch local folder and paste the file there.
5) Go to Pending Changes and "Undo" the changes in the wrong branch.
6) Check in only the file in the correct branch.

Add Folder to TFVC with VS Code

I have an issue with vs code and source control TFVC.
when I make any check-in to the server. any new folder is not uploaded right.
any idea?
TFVC
In general, I prefer not to let my project file know about the node_modules folder at all. And the projects load faster and I don't have to worry about the large commit messages in source control.
To achieve that we can Customize which files are ignored by version control
So, I agree with Daniel, in your scenario, if you mean you want to check in the node_modules folder and its sub-folders. Then you need to check if you have set the ignore rules in .tfignore file. If you set, just remove it.
UPDATE:
Based on OP's comment, as a workaround we can use Visual Studio to sync up the folder. (Check in the folder with VS, then sync to VS code)

Undo "take server version" of project file

I did a GET and stupidly took the server version of the project file I was working on. I had made many additions and changes to the project (ie adding directories and files) that are now no longer showing up in my solution explorer, but the files are still on the file system.
Is there any way I can undo "just" the project file "take server version" so I can do a proper merge?
You can't undo the get; the version with your modifications has been overwritten. You can, however, add all the files back into the project. The easiest way is usually to enable 'Show All Files' and then for each missing file you can do 'Include in project'.
You can try one thing, in case your concerned file in the solution explorer is not yet closed try undo and keep doing it (Ctrl + Z) and it may help you restore your data.
I am answering late, but this may help someone....
In your Solution Explorer, right click the file you accidentally took Server version of, and then select preview changes to {file name}. You will see your changes there.

How to easily versioning my solutions (and keep database)?

I'm working on an ASP.NET MVC website. Each time I do important modifications, I copy/paste the entire folder of my solution and rename it something like MySolution v1.1, next time MySolution v1.2, ... In that way, I can always step back easily and keep versions. But I always have problems with the database.
Example:
I work on MySolution v1.1 with the database in the App_Data named MyDB1.mdf
I copy/paste previous version in MySolution v1.2 folder
I cannot run successfully this newly created solution because Visual Studio will try to recreate the database named MyDB1.mdf but this one already exist (in the previous folder).
I had to change database name in the connectionstring of the web.config file and clean the App_Data folder.
This is not a good way of doing things. Furthermore, I lost my data in my DB because I delete it each time.
Does someone can give me advices for versioning my different solutions?
I hope I was clear.
Thanks in advance.
I'd suggest using a revision control system, such as Subversion or Mercurial (using TortoiseHG). This way, you can just revert to a previous version of your code if you don't like the changes you made.
I encourage you to get familar with source control. This is really important and every developer should know about it.
Here some source control systems:
Subversion
GIT
Mercurial
There are other version control systems as well. Personally I prefer Mercurial.
Hope this helps!
Use version control.
If you are working in VS you can use TFS. It has good integration into it and easy to learn (free TFS for open source projects can be found on www.codeplex.com).
Also you can use GIT (www.github.com), TortoiseSVN, etc.
Also you can do versioning for Database. In this case you can store database schema in Database project or create change scripts for database.

Clean checkout from TFS 2008

I want to pass a project to a colleague without SCC bindings to avoid accidental changes in my repository.
Is it possible to do a clean checkout from a TFS 2008 repo? I'm going crazy finding such an option in VS2008.
Thanks in advance.
I don't think this is possible. As far as I know TFS does not contain an export like functionality as SVN does.
You can do a hard "unbind" However as:
File -> Source Control -> Change Source Control and then unbind and/or disconnect all projects and the solution.
But watch out this will remove the bindings from the solution and project files.
Rody has a good answer, but here is another hack way to do it.
If you delete all the .vspscc files and then reload the solution it should prompt you saying that it cannot find all the source control information, and one of the options from that is to work disconnected.

Resources