Skip to main content

Git subcommand for getting a repo browser link to a git object

Project description

Git link is a git sub-command for getting a repo-browser link to a git object. The motivation behind git-link is that it is often faster to navigate to a git object or path on the command line than it is to click your way to it through a web interface.

Git link can build urls for the following repo-browser: cgit, gitweb, github, github-private


$ git link -h
Usage: git link [options] <commit|tree|blob|path|branch|tag|diff>

  -h, --help            show this help message and exit
  -v, --version         show version and exit
  -c, --clipboard       copy link to clipboard (overwrites link.clipboard)
  -u, --url <url>       repo browser base url (overwrites link.url)
  -b, --browser <type>  repo browser type (overwrites link.browser)
  -r, --raw             show raw blob if possible

Available repo browsers:
  cgit github-private github gitweb

  git config --add link.url <repo browser url>
  git config --add link.browser <repo browser>
  git config --add link.clipboard false|true

  git link HEAD~10        -> url to 10th commit before HEAD
  git link v0.1.0^{tree}  -> url to tree object at tag v0.1.0
  git link master:file    -> url to file in branch master
  git link path/file      -> url to path/file in current branch
  git link devel -- path  -> url to path in branch devel
  git link v0.1.0         -> url to tag v0.1.0


The latest stable version of git link is available on pypi, while the development version can be installed from github:

$ pip install gitlink  # latest stable version
$ pip install git+git:// # latest development version

Alternatively, you can install it manually like any other python package:

$ git clone
$ cd git-link
$ git reset --hard HEAD $versiontag
$ python install


Git link needs to know the name and url of the repository browser for every repository it is being run in. They can be specified either through git-config or on the command line:

$ git config --add link.url <repo browser url>
$ git config --add link.browser <repo browser name>
$ git config --add link.clipboard false|true # optional
$ git link   --browser <url> --name <name> --clipboard ...

Shell completion

Git link comes with shell completion for bash and zsh.

If you are installing system-wide, git link will attempt to place these files in the right locations.


See and if you are interested in adding a new repository browser. Running python test or py.test tests/ before committing is generally a good idea. You might also want to run tox to make sure that tests pass on all supported python versions (>=2.6).

Please make do without bringing in any external dependencies. As nice as GitPython and libgit2 are, anything that this tool needs from git can be queried using the command line tools.


Git link is released under the terms of the New BSD License.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitlink-0.2.0.tar.gz (20.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page