Quick Tip: Alias Hub as Git on Windows
If you use Git with GitHub, the Hub wrapper utility by GitHub is a better cli option for working with your personal and org repositories. In addition to all of the normal git commands, you gain GitHub specific ones like
browse, and many others.
Install Go Dev Environment
choco install golang -y
- Add/Set the
%GOPATH%environment variable that points to your Go installation bin directory. If installed via Chocolatey, that path is
go get github.com/github/hub
- Add Hub to
Set up your aliases
In order to save your alias between sessions, you need to do a bit more setup depending on your preferred shell.
- Find your default profile. Fastest way is to open a Powershell window and use the following command
Get-Variable profile. This will return something like
- Edit the above file and add the following line
Set-Alias git hub. The result should look like the following:
- Create a batch file that will hold the alias command, something like
- Add the following line to the batch file
doskey git=hub. The result should look like the following:
You can use your new alias file in a couple of ways depending on what you want to do.
- Just launch
cmd.exewith and pass in your new alias file
cmd.exe /K c:\Utils\aliases.bat. Now all of your doskey commands will be available in that console session
- Add to the registry so your aliases are available in every console session automatically. Run regedit and go to
HKEY_CURRENT_USER -> Software -> Microsoft -> Command Processor. Add String Value entry with the name
AutoRunand the full path of your .bat/.cmd file
c:\Utils\aliases.bat. See the full answer on StackOverflow.