I’m very new to source control management and one thing puzzles me: is it possible to search through the whole repository for a string? For example I’m tracking one file, which has 100 commits and I would like to see all the version of the file which contain “xyz” inside.
Is this possible? I’m using various GUI clients and non of them has this..? Yes, they can search trough commit messages but I want to find a version even when the commit message does not contain the string.
To put it differently, which GUI client has such a feature? I don’t care about which SCM it uses – git, hg, bazaar, all are fine.
3
In git, that’s one of the central features, called pickaxe:
git log -Stext
git log -Gregexp
That will look up revisions that add or remove matching text anywhere. You can of course combine it with path filters and revision ranges and any other options.
Very crudely, you could
git log -p -- path/to/file
Then search in there (using ‘/xyz’) and find the commits you’re looking for. There’s probably a better way, but that’s a quick and dirty solution that doesn’t take much thinking.
Update: SourceTree from Atlassian allows you to search through mercurial and git repositories based on commit message or file changes. I think this probably does just what you want. The user interface for SourceTree is pretty complex, and I’m not a huge fan of it myself, but when you open your repo in it, you can click the search magnifying glass tab at the very top left of the window, then select search “File Changes” in the drop down to the right of the search box. Hope this helps.
3
My preferred version control is Mercurial. There are a lot of options available for searching via a graphical interface however these are the methods I’ve utilized most heavily.
In a terminal, you can hg serve
. Then, hop over to a browser for more of a GUI interface. The address localhost:8000 is the default url for seeing a repository that you are serving.
Alternatively, you could use a 3rd party service such as kilnhg.com. They have a great interface that integrates nicely with their bug/feature tracking software, fogbugz.com.
Lastly, you might like TortoiseHg. It’s a local application that provides a GUI for your repositories.
2
There is hg grep
which does that (see hg help grep
), though I don’t know if it’s exposed in any GUIs.