This question already has an answer here:
Is there a git style amend option in TFVC?
(1 answer)
Closed 5 years ago.
For my project I use VS Team services, linked to Visual Studio 2015.
When I want to check in a new commit, I can do this:
In solution explorer, right click on project
Source Control -> Check In
Enter a comment, click 'Check In'
Now I would like to amend my previous commit, since it wasn't finished completely when I checked it in, in GIT this is possible with the git commit --amend function.
How to do this in VS Team Services? Preferably from Visual Studio itself.
You can't really, there are 2 approaches you can take with TFVC:
Make a second commit and don't worry about it, this is my approach for small typos, etc.
Rollback the changeset, and check it in. Then rollback the rollback and make additional changes and check in again. This is my approach if I totally stuff something up.
Related Question/Answer.
All you can ammend in TFVC is the Check in Comment, this can be done by viewing the change set in VS, editing the comment and pressing "Save".
Related
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.
A while ago, I accidentally checked in some unfinished unittest files I had changed and added in solution A together with some files that contained an actual bugfix for project B.
For some unknown reason I never noticed the checkin was going to include files from another solution so the checkin was done, after which other team members added more checkins to both solutions.
My question now is two-fold;
How can I undo the part of the checkin that hit solution A without affecting B at all
Is there a way to prevent mistakes like this from ever being possible to happen within Visual Studio (Enterprise 2015), make it impossible to checkin files not part of the currently opened solution somehow?
I think the easiest solution would be to use the ROLLBACK command, if you have installed the TFS power tools (TFPT) you should be able to do it within visual studio.
In your current branch, get the latest version from server then view history and find your changeset. Then right click and select "Rollback entire change set".
This will rollback the changes in your local workspace and checkout the file. (If there are conflicting changes you will have to resolve conflicts.)
Now when you are ready to check-in, exclude/undo the files which you don't want to rollback.
Commit/checkin the files which you want to rollback.
I haven't seen a better way of doing this, and think that this is much better than individually rolling back each file in the change set.
Now to answer your second question: check this ANSWER which I wrote a while back. I am copying it here for convenience.
As far as I tested, this default setting is controlled by the following registry entry. If the value of this registry entry is set as 1, then it should change the default behavior to filter by "Solution Changes".
"HKCU\Software\Microsoft\VisualStudio\12.0\TeamFoundation\SourceControl"
Name: FilterPendingChanges
REG_DWORD
Value: 1 = Show Solution Changes
Value: 0 = Show All
I am fairly new to TFS, like Mel from this post:
https://softwareengineering.stackexchange.com/q/142977/27650
I had a project on another PC, but I have been issued another PC.
Yes, I could go to management, and bug them with all of the various steps involved with finding and then getting my shelf project that I was working on last week, but I would rather find the information on my own.
I found MSDN's article on Shelve and Unshelve Pending Changes, but it did not cover how to get my shelf item. Perhaps there is a special term that I am unfamiliar with.
Likewise, I read over the article What's New in Visual Studio TFS 2012, since we are using VS2012. It appears to go over the changes that have occurred since the newest release.
How do I find my shelf items, so that I can continue working on them?
your question is answered under "Unshelving" on the page you referred to (Shelve and Unshelve Pending Changes). You click on unshelve and first step you do is finding your sehlveset. However please remember it works only if you shelved your changes before you lost your PC.
I got this resolved, but I did not like the way I found to do it.
In Team Explorer, I opened my last successful shelf item, did a Right-Click and selected View Shelfset Details:
From there, I went to each file listed in the Changes to Unshelf list.
I selected Open for that file, and then physically copied the text from that file to the corresponding file on my PC.
Again, I did this for each file that had changed in my Shelfset Details.
For whatever reason, Team Foundation Server does not pull that data back into my project whenever I select the "Unshelve Changes" option.
This question already has answers here:
VS2012 return to a normal TFS checkin window?
(5 answers)
Closed 9 years ago.
The TFS Pending Changes has moved from its own window to a tab in the Team Explorer.
The pending changes are now displayed as a treeview that reflects the structure of the solution.
How can I display the pending changes as a flat list/grid that can be sorted by various columns?
It's possible to add "TF.exe Checkin" as an external tool, see answer for a similar question.
However it pop-ups after some delay, which is annoying.
I found that if you have only a few recently checked-out files that you want to check-in together, using pending changes tree view is quicker. However if you need to check-in some of many check-out files, "TF.exe Checkin" list is more convenient.
Alternatively try TeamPilgrim Free VS extension -
a replacement for Visual Studio 2012's Team Explorer inspired by the Visual Studio 2010's Team Explorer by Stanley Goldman
After experimentation, I've found it's a link on that page, Show all included changes:
#G_P added this as a comment to a different answer, but I think it deserves an answer slot of its own.
The TeamPilgrim extension includes a replacement pending changes window/tab.
http://visualstudiogallery.msdn.microsoft.com/79e9baa7-ea8b-4335-86ba-ae929bf67222
There is a "pending changes" filter on the Visual Studio 2012 Solution explorer. It will display all your files that are checked out the same as the Team Explorer, but without all the extra garbage about Notes or Work Items.
http://blogs.msdn.com/b/visualstudioalm/archive/2012/08/14/showing-files-with-pending-changes-or-files-that-are-open-in-visual-studio-2012-solution-explorer.aspx
Does a feature like "TFS auto-checkout before checkin" exist, so that I don't checkout any file until the moment I say "checkin", e.g. in case I only change files temporarily - which happens all the time.
In other words, client-side I want to work as if using subversion, regardless of what the TFS server might think. This must be possible, I just wonder if it is easy to setup.
In yet other words, until and unless I say 'checkin', other users shouldn't (be able to) bother what files I'm editing.
These answers are fine assuming you always work in Visual Studio. But imagine the scenario of editing a bunch of files outside of Visual Studio and you want to use Windows Explorer TFS powertools to automatically checkout files which were just modified. Well, there is no automatic checkout. What I ended up doing was to sort the files by the "Date Modified" column and then individual selecting the modified files only. You can't select any files which might be added, as the TFS power tool Windows extension will grey out the "Check Out for Edit.." The other frustration is that TFS power tools doesn't have a file icon to differentiate if a file is currently checkout or simply not yet added to TFS. Basically, TFS is terrible working with more than file at a time unless you are exclusively working within VS, but who does that.
SVN kicks TFS when it comes to this type of scenario.
You can tell Visual studio not to check out on edit, go to tools, options, source control, environment. Then select the behaviour you want. If you choose editing to "do nothing" and saving to "prompt for checkout" it should be pretty close to what you want.
You could also look at svnBridge which allows you to use TortoiseSVN with TFS. I assume that the point of svnBridge is to allow developers used to SVN to use TFS without having to change the way they work, so it should meet your needs.
A combination of both of these should get you close.
From time to time I hear from people who dislike the automatic check out behaviour common with TFS. One of the great things about TFS is the the pending changes list that shows you the files you have currently checked out and allows you to easily undo any un-intentional check outs. While I personally find the auto-checkout features a productivity boon - like most things there is a preference that you can use to adjust the default behaviour if you find it causes problems with the way you like to work.
In Visual Studio 2008 (with the Team Explorer 2008 installed), go to Tools, Options, Source Control, Environment and change the Checked-in items for Saving and Editing to "Prompt for check out" rather than the default which is "Check out automatically".
No. When you check in TFS will checkin those files, you have to just undo those files.
However checking out a file doesn't stop others from checking them out, unless you've locked them. This non exclusive locking is the default behaviour.
No. But you can do one thing - Open solution in 2 Visual Studio, One in which solution is Online and another in which solution is offline. Do all your changes/work on Offline solution. After completing your task.
Go to first VS (Online) and checkout the files containing your changes.
Go to Second VS (Offline, containing your changes) - It will prompt for file changes and click "No to All" so that all your changes persist.
Press Save All.
First Solution (Online) will prompt for new changes and click "Yes To All" so that all your changes done in offline mode will get in new files.
Get Latest. - Any conflicting changes will be reflected (Try automerge - if you're lucky will work perfectly)
CHECK-IN
Though a tedious task but a workout for your question.