How do I know which files I actually changed since my last TFS checkout? - visual-studio-2010

I've checked out a bunch of files from TFS in VS2010 and made changes to several of them. How can I see which files I actually made changes to?

Use the TFS power tools. Open a visual studio command prompt, navigate to your workspace and then type
tfpt uu /noget /recursive
This will undo any pending changes on files that haven't been modified

Is View -> Other Windows -> Pending Changes what you are looking for? That lists all of the changes in your selected workspace that are pending a check-in. It looks (and behaves) differently in VS2010, but here's what it looks like in VS2012.

To add to hawkke's answer, I use CTRL-K C to show the pending changes window - very useful.
(hit ctrl-k and the then 'C' key right after).

Related

Visual Studio Team Explorer only checkin some files

We're upgrading from Visual Studio 2010 to 2015. When I use Team Explorer to checkin files, on VS 2010, I could select a directory and it showed all the checked out files in that directory with a checkbox so I could unselect certain files I don't want to checkin. But the checkboxes seem to be gone in 2015, so I have to checkin everything in the directory. Is there a workaround to bring back the checkbox?
(Note I am not asking for a .gitignore to never check in certain files. I do want to check in the files, just not yet. Right now I want to checkin only some of them).
Right click the file in the Pending Changes view and choose "Exclude".
The feature of "Check Box" is gone in VS2015. For now, there are only Included Changes and Excluded Changes.
According to your description, you just need to click and select those files(use ctrl or shift to multiple select) and right click "Exclude"
After the operation, those files will add in Exclude list. You will not check in them. Once you want to check in them again, you just need to included them back to include list.

Visual Studio 2010 - How to enable prompt to delete file from disk when removed from project?

In Visual Studio 2005, when you remove a file from a C++ project (by right-clicking in the Solution Explorer and selecting "Remove"), it asks you whether you just want to delete the reference, or also delete the file itself from disk.
In Visual Studio 2010, this prompt seems to have disappeared (or I have accidentally turned it off). This means that every time I delete a file in the Solution Explorer, I have to immediately hunt it down and delete it with Windows Explorer (otherwise I'll forget and it will stay around forever). How do I get the prompt back?
I found some documentation (http://msdn.microsoft.com/en-us/library/0ebzhwsk%28v=vs.100%29.aspx) explaining the difference between "Remove" and "Delete", and that "Delete" doesn't exist for C++ projects (but no reason is given). Maybe it's really just not possible? If so, what an annoying regression.
You get the remove or delete file dialog only if the selected file is stored in the project folder. If the file is stored outside of the project folder the file reference is removed without dialog.
This behaviour is still the same for e.g. VS2013. I created a user voice request to change this behaviour here. IMHO your file hierarchy should not make any difference.
You can vote for the change here:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/9146353-remove-delete-dialog-should-show-up-when-deleting
Assuming one is using Sourcegear Vault as the source control system, you can enable the prompt by going to Tools -> Options -> Source Control -> Integration Options -> and check on "Show warning before deleting items from source control"

Tracking changes in Visual Studio

Is it possible to set up Visual Studio (2010) for tracking changes (left color symbols) not from last file open state, but from source control commited state? This is how netbeans works and it is really great feature, especially reverting text block from editor by right click... Visual Studio default tracking mode is not much useful.
EDIT 1:
Something like this way:
EDIT 2:
Now it works with latest Git Source Control Provider (http://visualstudiogallery.msdn.microsoft.com/63a7e40d-4d71-4fbb-a23b-d262124b8f4c) extension. Good job, extension developers. Left bar is standard visual studio tracker, right bar is tracker tracking changes against last commit. See picture:
EDIT 3 (12/05/2015):
Now I use standard VS git tools and for change tracking great Git Diff Margin extension. I use it with VS2013 and 2015 and it works very well. See:
For people like me that skim straight to the answer -
OP (12/05/2015) - Now I use standard VS git tools and for change tracking great Git Diff Margin extension. I use it with VS2013 and 2015 and it works very well
Git Diff Margin
Works great for me as well!
Seems like if you have Visual Studio 2013, and you're working with GIT, it does work.
Also, you can see what happens in the Team Explorer tab.
There is no such facility in VS to do this. I rely on CTRL-Z to undo. If there are too many changes, you can do a git checkout -p -- . which will walk you through all the differences and apply the ones you need. The -p (or --patch) parameter is available on git reset, git add and git checkout.
That being said, one could write an add-in to VS to give you this view.
Also, I use CTRL+- and CTRL+SHIFT+- to move back and forth between my recent cursor positions.

Stop Visual studio Auto-selecting files in Pending Changes after checkin with TFS

I use the Pending Changes window in Visual Studio 2010 to manage my files and to checkin with TFS.
My problem is that I will often be working on something and have files checked out then go onto something else, and then something else etc.... I have a lot of files checked out at once.
When I do a checkin, even if its just 1 file visual studio automatically checks the checkbox next to all other files so I have to go through and uncheck the files I dont want for my next checkin.
Is there any way to turn this feature off?
Thanks
I don't think you can turn of this feature. To better control this behaviour you have a few options:
Select the folder in which you have the files that you want to check-in and right-click for the menu and choose from there for Check-in pending changes. That will select only the files within the folder/subfolders or project that you selected from the solution explorer.
You can use a trick to deselect all files marked for check-in in the pending changes window, by selecting one file, press CTRL-A and deselect a file.
Hope that these tips will give you a smoother check-in experience. Also take a note at the comment by Lars Truijens about not mixing changes. It will be very hard to separate these checkins at not break the build at some time.

How to have TFS 2010 detect changes done to files outside of Visual Studio?

I'm using Team Foundation Server 2010 with Visual Studio 2010.
Whenever I modify a file outside of Visual Studio, TFS doesn't seem to detect the change done to the file, and thus doesn't offer me the option to check-in the file after it has been modified.
How can this be solved?
TFS has a "Reconcile" command for this:
Open the Source Control Explorer
Right-click on the folder with the changes and choose Compare
Select the files you want to reconcile (press CTRL+A to select all files)
Click on the Reconcile button
Set the options in the Reconcile Folder Differences dialog. Make sure Files that do not have pending changes is set to Check Out
Click OK
If you have local changes the Check Out dialog will be shown. Set the preferred Lock type
Click Check Out
See also: Reconcile differences between folders
If you have a network connection to your server while you're working outside of Visual Studio, it's probably best to go ahead and check the file out before editing it, either using the tf command line client, or using the Windows Explorer shell integration that's available in the TFS Power Tools release. (Plus an increasing number of other tools have TFS integration that makes this automatic, but if you're just using notepad, this still needs to be a manual step.)
Of course, there are many times when you're working and you don't have a network connection available that allows you to check out the files.
If you know what files you've modified, you can just check them out from within Visual Studio, then you'll be able to check them back in.
If you don't know what files you've edited, you can detect the changes by running the tfpt online command (also part of the Power Tools release). This will locate the files that have been modified locally and check these files out from the server.
This worked for me, using the TFS Power Tools:
tfpt online /adds /deletes /diff /noprompt /recursive directory-name
(where directory-name is the path to the directory to be updated, otherwise it will detect changes throughout your entire TFS repository)
If you want to know what it would do without it actually making any changes, you can force it to do a dry run by adding the /preview switch.
*1- make changes outside of Visual Studio
2- go to Visual Studio and open Source Control Explorer
3- right click on the folder > "Check Out for Edit" > "Check Out"
4- right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"*
I tested this workaround on a branch and it helped me a lot. But there are only new files and new folder who has to be done manually.
I recommend to create a branch before the operation. It isolates you the time of the operation.
Note: This technique does also the files identical cleanup that TFS always marks as modified.
Try this. It's some sort of workaround, but it works:
make changes outside of Visual Studio
go to Visual Studio and open Source Control Explorer
right click on the folder > "Check Out for Edit" > "Check Out"
right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"
That's it. The changes are visible now.
There's also another solution to get TFS to figure out the files that have changed outside of Visual Studio:
Open the solution offline
In Solution Explorer select the solution file and then press the Go Online button ()
TFS will automatically scan the solution for changes after this.
Step one can be achieved in a number of different ways. Here are some:
Use the GoOffline Extension - very simple and effective.
If you're asked for TFS credentials when opening the solution (no automatic domain auth), then don't enter the credentials. The solution will open offline and you'll login after pressing the Go Online button
(extreme solution) Disconnect your network cable; Open the solution; Connect the network cable.
Visual Sourcesafe works like this too and the way I get VSS or TFS to notice the change is by checking the file out once inside Visual Studio.
Open Source Control and go to your TFS folder. Right-click on the folder and choose 'Compare'.
Notice that your edited files show up marked in red.
I find this is better than tfpt online which also gets you files that are not readonly and not edited.
I had this problem in the past, when my Internet was down and I worked offline, and most of my changes didn't appears in Team Explorer.
Following these steps:
First, In the solution explorer, select the folder that you want to re-conciliate (for me, it was my entire solution folder), and select Compare...
Click in Modify Filter, and in the filter text-box, you could type:
*.cs;!obj\;!bin\;!packages\;
In this example, it will include in the search only C# files and exclude in the folders: bin, obj and packages.
Notice the column Pending Change has the info whether the file is marked as edit, add, etc... or nothing...
To mark as edit (when the local item has a matching server item), select the file and choose Check out for Edit...
To mark as add (when the local item doesn't have any server item), select the file and choose Add Files
Finally, I am not sure why the projects are not listed here (after I remove *.cs filter, still doesn't show up), so rebuild the solution to make sure the projects updates as well
+ In the solution, click the connect button (if shows up) that said Go Online.
I found that in Visual Studio 2015, with the project open, Visual Studio discovered for itself that files had been modified externally, and automatically checked them out without me having to do anything. Checking in the project in the normal way saved the external modifications.
In my case, the following worked (at least the one time I tried it):
Go to the Pending Changes panel
Select View Options under either Included or Excluded changes.
Switch between Show All and Show Solution Changes
Switch back if desired
Changing the View Option appears to force a refresh of modified files.

Resources