138

With TFS I need to find a changeset by comment, and/or by developer. Maybe I'm just blind today, but I don't see a simple way in the Source Control Explorer to do this task?

riQQ
  • 9,878
  • 7
  • 49
  • 66
Ralph Shillington
  • 20,718
  • 23
  • 91
  • 154
  • 1
    Now in VSTS / latest TFS you can now filter commits by author in commit history, but it seems you still can not filter / search on commits comments... I actually don't understand how this can not be proposed, I created a request on uservoice: https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/33810043-search-filter-commit-messages – Sÿl Apr 01 '18 at 06:45

11 Answers11

168

If you have TFS Power Tools installed, you can run this in a command prompt:

tfpt searchcs

to get a GUI window with options to search by committer and comment text. I'm using TFS Power Tools (March 2011 version) and TFS 2010.

StuperUser
  • 10,555
  • 13
  • 78
  • 137
Kent Hu
  • 2,044
  • 2
  • 15
  • 7
  • 4
    This worked for me, with some thrashing on the settings. `Server name:` my server URL format was http://tfs01:8080/tfs, which I found in VS2010, Team menu, Connect to Team Foundation Server, Servers... button, and there was the existing server. `Under server path:` I noticed it's really looking for the local map path, so it was C:\tfs\myfolders\etc, not the url path from the server's point of view. – goodeye Oct 07 '11 at 00:46
  • 1
    Stackoverflow converted my above comment regarding my URL format to a link. It's really `http://tfs01:8080/tfs` – goodeye Oct 07 '11 at 01:28
  • Worked for me with VS2010, even though TFS is 2008. TFPT2010 latest version, August 2011 – Paul Kapustin Oct 17 '11 at 13:20
  • 1
    Works in Visual Studio 2012 with TFS 2012 as well. – jessegavin Jan 11 '13 at 17:50
  • 2
    This worked for me from cmd.exe but not from the VS command window. – rstackhouse Feb 01 '13 at 16:54
  • Does not work for me in VS 2013, had to do it from command prompt. – Rush Frisby Dec 13 '13 at 14:10
  • works for me for vs 2013. make sure power tools 2013 is installed. – btevfik Jun 25 '14 at 17:09
  • You can specify the server and path on the command line, so the dialog opens ready to use: `tfpt searchcs /collection:http://tfs01:8080/tfs D:\tfs\myfolders\etc` – goodeye Dec 31 '14 at 18:53
  • Worked for me on VS 2015 with TFS 2013, only after I specified /collection and filesc in the command line as the above comment did. – Aaron Thomas Apr 22 '16 at 18:40
  • For VS 2015, I found the [Microsoft Visual Studio Team Foundation Server 2015 Power Tools](https://visualstudiogallery.msdn.microsoft.com/898a828a-af00-42c6-bbb2-530dc7b8f2e1) package, which I believe is simply the current release of the one linked in this answer. – JMD Jun 23 '16 at 18:35
  • If you `cd` to your local workspace directory, then run `tfpt searchcs`, it will auto-populate the `Server Name` and `Under Server Path` fields to match those of your workspace. – Walter Stabosz Mar 05 '19 at 19:10
110

EASY WAY and no 3rd party apps/add-ons needed:

  1. Open Source Control Explorer
  2. "View History" from the root of TFS server
  3. Scroll to the bottom (it's fast with hitting "End" button continuously)
  4. Select all records, copy
  5. Open Excel and paste

Now the Excel will allow you to search through comments (Excel's a native app, don't argue..).

Ani
  • 2,636
  • 1
  • 21
  • 17
  • 15
    I don't think you will be searching the entire commit message for longer commit messages using this method (note the ellipses present when you paste), which would make this useful if you're sure that you're looking for something in the first-line synopsis, but dangerous otherwise. –  Sep 30 '13 at 17:46
  • 1
    such a simple and zero configuration way – Mostafa Armandi Jun 16 '15 at 08:52
  • 6
    I admit, at first I cringed when I first read this, but then I said to heck with third party tools, this idea works just fine. Thank you! – Chris Hawkes Mar 04 '16 at 19:49
  • Thank you for this. I tried downloading command-line tools and had no luck working with them. Always keep it simple, good job! – mdlars Jul 26 '16 at 16:37
  • 5
    This is not a solution when you have more than 100.000 changesets – Diogo Luis Mar 07 '17 at 13:48
  • 7
    It's sad that I have to do this. ;) – Kai Hartmann Feb 09 '18 at 07:11
  • 1
    Is there any way to get the entirety of each comment? Trying to use this to get work history and the stupid ellipsis thing is in the way :( – Richard Griffiths Jul 02 '20 at 13:38
21

With the Power Tools installed:

tf history $/ -r | ? { $_.comment -like '*findme*' }
Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
Richard Berg
  • 20,629
  • 2
  • 66
  • 86
  • 3
    Excuse my ignorance, but what's the "?" command into which you're piping the result of tfhistory? – Mal Ross Sep 02 '09 at 15:39
  • 3
    It's the standard alias for Where-Object. See "help where -full" for complete details. – Richard Berg Sep 02 '09 at 21:16
  • 5
    This doesn't work directly at a `cmd.exe` prompt, but it does in a PowerShell Console (with a few tweaks to the format of the -like parameter). – Emyr Oct 14 '14 at 10:43
20

There's a Visual Studio add-in that does it now: http://visualstudiogallery.msdn.microsoft.com/3f65dee8-5a44-4771-929b-26531c482fbf.

apaderno
  • 28,547
  • 16
  • 75
  • 90
David
  • 201
  • 2
  • 2
  • 3
    It's a shame it is not avaiale for VS 2012 and VS 2013 – Andrija Feb 26 '14 at 06:44
  • 2
    If you go to the CodePlex site of the project, you will find a VS2012 version (which I haven't tested). https://findchangeset.codeplex.com/ – Maarten Jun 02 '14 at 11:43
  • 2
    But to be honest, using `tfpt searchcs` is easier. – Maarten Jun 02 '14 at 11:45
  • Aha, yes. I've used it before but could not remember how I started it, lol. You just start the `Visual Studio Command Prompt` and execute the command @Maarten mentioned above. Of course, you would install Power Tools first! – strider Aug 25 '14 at 21:54
18

Alternatively, without having to install power tools, the following command will work if your looking for the search term findme.

Windows: tf history "$/Team Project/Development" /noprompt /recursive | findstr findme

Linux: tf history "$/Team Project/Development" /recursive | grep findme

NB. Please thank this guy if you found this useful.

Christo
  • 2,330
  • 3
  • 24
  • 37
  • 2
    add "/format:detailed" if you want to search the entire message. If this takes too long, set date bounds (e.g. "/v:D1/1/2012~D12/31/2012") to reduce the search space. –  Sep 30 '13 at 17:47
8

You can use the command line client: pipe the output of tf history to a file and then use whatever search program you prefer.

stuartd
  • 70,509
  • 14
  • 132
  • 163
  • 5
    example: tf history $/ /r /user:username /format:detailed > d:\changeset_details.txt – ray Mar 01 '11 at 21:13
3

Find Changeset By Comment 2013 for Visual Studio 2013 http://developer.azurewebsites.net/2014/08/find-changeset-by-comment-2013-for-visual-studio-2013/

Lauri Lubi
  • 529
  • 5
  • 8
3

I don't know a way to do it by Comment Text, but this will allow searching by developer:

If you open the menu item File->Source Control->Find In Source Control->Changesets... (you must be in Source Control Explorer for this to be available). This will open the Find Changesets dialog. You can then search for change sets by Developer on a given source folder (or project).

This will show you the comments, but you can't search by them. (Though you can sort the list by the comments and find the comment you are looking for that way.)

On a side note, if you want to see the details of the changeset via this dialog you have to click the Details button. Double clicking on a changeset closes the dialog.

Vaccano
  • 78,325
  • 149
  • 468
  • 850
  • 1
    @Downvoter - Why the downvote? The OP said "and/or developer". This is a "Or Developer answer". – Vaccano Aug 06 '14 at 22:34
2

To see the checkins for a team member:

In team explorer, navigate to the Team Project, navigate to Team Members, right click the team member for who you want to see the changesets, and select "Show CheckIn History".

Phillip Ngan
  • 15,482
  • 8
  • 63
  • 79
2

I added tfpt searchcs from the TFS Power Tools as external tool in VisualStudio:

  • Command: C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\TFPT.EXE (or wherever you installed your TFS Power Tools)
  • Arguments: searchcs /collection:http://tfsserver:8080/tfs $(SolutionDir) (the solution path is converted to the server path)
  • Initial Directory: c:\path\to\your\vs\IDE (unless the tf.exe is in your path (what is not the case by default) this ensures you can view the changeset details from the search dialog, for it runs tf.exe)
Spock
  • 260
  • 1
  • 13
1

I was able to do this in the TFS web portal code section.

Navigate to TFS in your browser, go to code, click on changesets, then advanced search. You can filter by user and date range. You can not search by comment, but if you have a general date range in mind then you can filter it down then use the browsers search (ctrl + f).

AlignedDev
  • 8,102
  • 9
  • 56
  • 91