gitmacros is a set of Visual Studio macros for aiding my git workflow.
- ShowFile - open the GitHub page for the current file
- ShowBlame - open the GitHub blame page for the current file
- ShowLog - open the GitHub commit history page for the current file
- ShowIssue - open the GitHub Issues page for a provided issue number
- Open the Macro Explorer (ALT + F8)
- Right-click on MyMacros and choose New Module...
- Name the module GitHubMacros (the name is important)
- Right-click on the new GitHubMacros node within MyMacros, and choose Edit
- In the Macro IDE, for the MyMacros project, Add a Reference to System.Core.dll
- Copy the entire contents of GitHubMacros.vb over the conent in the GitHubMacros editor window
- Save the MyMacros project
You should now be able to run the macros by double-clicking their names in the Macro Explorer.
For convenience, you will probably want to map them to a toolbar button, context menu, or keyboard shorcut. I mapped them to keyboard shortcut chords:
- In Visual Studio, go to Tools | Customize...
- Click the Keyboard... button
- In the "Press shortcut keys" input, press CTRL+L
- For each of the listed items in "Shortcut currently used by"
- search for that command in the "Show command containing" input
- click the Remove button to unassign it from CTRL+L
- In the "Show command containing input", type: GitHubMacros
- Select ShowLog, in the shortcut keys input, press CTRL+L, CTRL+L
- Select ShowFile, in the shortcut keys input, press CTRL+L, CTRL+F
- Select ShowBlame, in the shortcut keys input, press CTRL+L, CTRL+B
- Press OK and Closet to close the dialogs.
The macros jump to the wrong github fork
The macros try to figure out the correct GitHub web URL by reading your configured remotes. It will use the first remote it finds that refers to github.com. If you have multiple remotes for GitHub forks of your repository, and the macros bring you to the wrong page, you will need to manually edit your .git\config file and move the remote definitions so that your desired remote is listed first.