This PowerShell script provides a way to open the GitHub repository for the current folder in your default web browser. It extracts the remote URL of the repository, parses the author and project name, and constructs the GitHub URL to open in the browser. Additionally, it supports opening specific pages like issues, pull requests, actions, projects, releases, and branches.
- Copy the
Open-GitHubRepo
function fromOpen-GitHubRepo.ps1
into your PowerShell profile and save it. - Close PowerShell and open a new instance of it.
- Browse to a folder containing a repository and type
Open-GitHubRepo
with the desired parameters into PowerShell. - The repository should open in GitHub.
- Open the main repository page:
Open-GitHubRepo
- Open the issues page:
Open-GitHubRepo -Issues
- Open the pull requests page:
Open-GitHubRepo -PullRequests
- Open the actions page:
Open-GitHubRepo -Actions
- Open the projects page:
Open-GitHubRepo -Projects
- Open the releases page:
Open-GitHubRepo -Releases
- Debug mode to see detailed information:
Open-GitHubRepo -Debug
Parameter | Description |
---|---|
-Issues |
Opens the Issues page of the repository |
-Branches |
Opens the Branches page of the repository |
-PullRequests |
Opens the Pull Requests page of the repository |
-Actions |
Opens the Actions page of the repository |
-Projects |
Opens the Projects page of the repository |
-Releases |
Opens the Releases page of the repository |
-Debug |
Outputs detailed information for debugging |
Alternatively, you can use the git open
command from git-open, a tool that allows you to open the GitHub repository in your browser directly from the command line.
If you prefer a simple PowerShell-only approach without relying on additional tools, this script provides a simple and effective solution for opening GitHub repositories in your web browser directly from the command line.