I need to rebuild my local workspace on my workstation in order to remove a number of conflicting changes that prevent me from making further changes.
I'm getting the following error and need to resolve it so that I can continue with my work.
Conflict "uc_example.ascx.cs" - Unable to perform the get operation Because you have any available conflicting edit
I prefer to do this from the command line.
Try to resolve the issue first
To see what changes there are pending on the file in question you can run:
tf status $/path/to/your/uc_example.ascx.cs /format:detailed
/collection:http://yourserver:8080/tfs/YourCollection /user:*
Optionally include a workspace using teh /workspace:name parameter.
To undo the pending changes on your file (make sure you have a backup of the to be content):
tf undo $/path/to/your/uc_example.ascx.cs
/collection:http://yourserver:8080/tfs/YourCollection
Optionally add the workspace where you need to undo the change (you may need to have Undo other people's changes permissions).
tf undo $/path/to/your/uc_example.ascx.cs
/workspace:TheWorkspaceWithEditYouWantGone;OwnerOfSaidWorkspace
/collection:http://yourserver:8080/tfs/YourCollection
To see what changes there are pending on the file in question you can run:
tf status $/path/to/your/uc_example.ascx.cs /format:detailed
/collection:http://yourserver:8080/tfs/YourCollection
If there is a pending delete you cannot try to check in a pending edit. Or if there is a pending merge you cannot do a delete. This may happen when you delete a file (which pends a delete), then create a new file with the same name (which will try to pend an add, and fails). You will either need to check in your delete first, or undo your delete and then overwrite the file. You can't delete and add in the same checkin.
If that fails, blow away the workspace
If that doesn't help you can remove the workspace, create a new one, get the latest sources, reapply your changes and try to check them in.
WARNING THIS WILL BLOW AWAY ALL PENDING CHANGES ON THE WORKSPACE
MAKE SURE YOU HAVE A BACKUP BEFORE PROCEEDING!
tf undo /workspace:YourWorkspaceName /recursive /noprompt
/collection:http://yourserver:8080/tfs/YourCollection
tf workspace /delete /collection:http://yourserver:8080/tfs/YourCollection
/workspace:YourWorkspaceName
tf workspace /new /noprompt /collection:http://yourserver:8080/tfs/YourCollection
/location:local YourWorkspaceName
tf workfold /map $/Server/Folder d:\Your\Local\Path /workspace:YourWorkspaceName
/collection:http://yourserver:8080/tfs/YourCollection
WARNING BELOW LINE WILL GET AND FORCE ALL FILES TO THE LATEST VERSION
tf get d:\Your\Local\Path /recursive /version:T /force /overwrite
But if the item has a conflicting change on another person's workspace, it won't help you to blow away your workspace.
Related
If a user selects to "Discard All Changes", will this restore a deleted folder in Git for the working tree or will it delete the folder entirely?
Issue resolved. I was concerned that if I ran the "Discard All Changes" command, my folder would be deleted entirely. I thought that was strange considering that if you visit a single file that was deleted in the folder, VS Code gives the option of restoring that file, but I wanted to undo the entire folder deletion. Since I didn't stage or commit the changes after I deleted the folder, I was able to revert the change in my working tree by running the following command:
git checkout -- path/to/folder
That command allows a user to revert changes that have not been indexed or added to the staging area.
I found this helpful
https://stackoverflow.com/a/30875442/10860528
I'm trying a simple TFS 2015 checkin automation. I have a local workspace mapped to a local folder. In that folder, I added some files and deleted one. What I want is to checkin those changes
I run this command
tf.exe checkin <folder> /recursive
The result (unexpected) is "no pending changes"
If I run the following command
tx.exe status <folder>
I get the list of changes expected.
If I look in Visual Studio source code explorer, I cannot see my changes but if I try to add items in the TFS folder, I can see new files.
Can you help me to understand how I can automate this checkin scenario?
EDIT : based on this SO thread, it seems it is not possible to achieve this with local workspace. Can someone confirm?
You need to run "tf add" command to add these files into Pending Changes before run "tf checkin" command:
tf add * /recursive
Since TFS get-latest operation is non transactional there is no way to abort merging code after issuing get latest. Both Git and ClearCase allows you to backout of rebase operation. So one way I came up with is is to create a shelveset right before I get latest so I can abort and retrieve my code if there's too many conflicts that I don't want to deal with immediately.
My question is is there a way to automate the creation of a shelveset when you do get latest, ideally overwriting an existing one if it exists (say with a hardcoded name "HEAD").
Running the following command will auto shelve current workspace files and get latest:
tf shelve "HEAD" /comment:"Autoshelve" /replace /recursive /noprompt&tf get
You can store it in a .cmd file under your project's root folder in the source control.
I've manually deleted some files/folders in my workspace. How do I pend deletes for those items in my TFS workspace and get those deletes to be reflected in the repository (via command line or programmatic API).
You should be able to use the tfpt online /deletes command from the Team Foundation Server Power Tools. It will prompt you to "promote" any untracked local changes that not in the Server Workspace.
Deleting items within your working folders will not reflect the delete within source control. To delete the items from source control do the following:
Delete it from source control ui, do this by right clicking the item and deleting then committing the change.
Open VS Command line and run the tf properties command, example: tf properties /s:TFSServerCollection "$/FilePath/Filename.jpg"
This will let you retrieve the delete ID, for this example lets say the delete id 12345
In the same VS Command line window, run tf destroy command, example: tf destroy /s:TFSServerCollection "$/FilePath/Filename.jpg";x12345
Don't forget to add the 'x' before the delete ID. Press enter and it will prompt you if you want to delete the item. Say yes, and then press enter. Just be careful as tf destroy complete removed the item and/or folder from source control including it's history.
In Visual Studio 2012: These deletions will be detected, but listed in the "Excluded Changes" section. Open this list and click to "promote" the changes.
Deleted Files can be checked-in like regular changes, however - if you use Solution-Explorer to checkin, deleted files aren't included (because only files which are STILL in the solution are included in the changeset).
I ALWAYS do my checkins via the source-control-explorer - then deleted files are also included in the checkin (if those deleted files are below the source-control-folder you are checkin in)
Greetings
Johannes
P.S.: if you delete the files via windows-file explorer, they aren't marked as "deleted" in your working copy. ALWAYS use VS2010 to delete files (or alternatively the shell extension included in TFS Server-Powertools)
I have a huge repository. A while ago a file with the name FooBar.xml was deleted from some unknown directory in the tfs. What would be the easiest way to find the file? There are thousands of directories in the repository, so manually inspecting each and every one looking for deleted files is not a feasible option.
From a Visual Studio Command Prompt use the command
tf undelete $/TeamProject/FooBar.xml /noget /recursive
This will undelete any files in the repository with the name FooBar.xml, and leave the undeletes as pending changes. If you can narrow it down to a particular branch or area of your repository that will speed things up.
You can then go though the list of pending undeletes, identify the file you want to keep and "undo" the other pending changes.