git-url

generates an url to the specified file and/or commit in GitHub or GitLab

This script has a lot of options. The short version is that you should use this when you need to share a link to a file, or a branch in a GitHub repo.

You should also consider using this when you want a teammate to render an opinion about a piece of code you’re working on. Commit it. Push it to GitHub, or GitLab and use this to generate a link they can use to see it.

Usage

USAGE: git url [-o | -l line-num | -b branch | -r remote] [path/to/file/in/repo]

       Generates a link to:
       * a specific treeish / branch
       * a specific treeish / branch in a specific remote
       * a specific file at a specific treeeish / branch in a specific remote
       * a specific line in a specific file in a specific treeish / branch in a specific remote
       * various other combinations of those ;)

       Supports linking to repos in GitHub and GitLab.

       -b branch name to link to - defaults to current if not specified
          can't be combined with -t
       -l line number to link directly to
       -o open in browser
       -r specify the remote repo to link to
       -t treeish  defaults to the current branch name
          but can be commit hash, tag, etc.
       -w link to the raW file

       You *must* specify either a path, a treeish/branch, or both.

Metadata:


Tags:

  • git
  • sharing