Open the current git repo directory on GitHub in your default browser.
Run this in a directory within a local git repo. The directory will be opened in your browser such as on GitHub.
- Works for any user or org, as long as
.gitdirectory exists at some level. - Recognizes subdirectories.
- Handles branches.
- Supports any host - GitHub, BitBucket, GitLab, etc.
- Works with both SSH and HTTP remote urls .
git@github.com:USERNAME/REPO_NAME.githttps://github.com/USERNAME/REPO_NAME.git
$ open-repo
Opening: https://github.com/MichaelCurrin/unicron/tree/master- Download or copy the contents of the script. You can omit
.shin the name - it just helps for syntax highlighting when viewed on GitHub. - Add as a shell script in
~/bindirectory or somewhere else in your PATH. - Mark it as executable.
$ chmod +x open-repo- Navigate to a git directory and run the script as you named like.
$ cd my-repo
$ open-repoHere is a demo of running commands in the MichaelCurrin/unicron GitHub repo.
$ git clone git@github.com:MichaelCurrin/unicron.git
$ cd unicron$ open-repo
Opening: https://github.com/MichaelCurrin/unicron/tree/master$ cd docs
$ open-repo
Opening: https://github.com/MichaelCurrin/unicron/tree/master/docs/$ git checkout my-feature
$ open-repo
Opening: https://github.com/MichaelCurrin/unicron/tree/my-feature/docs/