Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/spenserblack/gh-permalink

Create a permalink from the CLI
https://github.com/spenserblack/gh-permalink

gh-extension

Last synced: 24 days ago
JSON representation

Create a permalink from the CLI

Awesome Lists containing this project

README

        

# gh permalink

[![CI](https://github.com/spenserblack/gh-permalink/actions/workflows/ci.yml/badge.svg)](https://github.com/spenserblack/gh-permalink/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/spenserblack/gh-permalink/branch/main/graph/badge.svg?token=HOyIAY5JyM)](https://codecov.io/gh/spenserblack/gh-permalink)

Create a permalink from the CLI

## Installation

```shell
gh extension install spenserblack/gh-permalink
```

## Usage

```shell
# Permalink a file
gh permalink my-file

# Permalink a line
gh permalink my-file 1

# Permalink a range of lines
gh permalink my-file 1-5
```

### Advanced

#### Permalinking Commits

This extension creates a permalink from the current HEAD commit. If you need to create a permalink
to a different commit, checkout that commit first.

```shell
git checkout v0.1.0
gh permalink my-file
# now you have a permalink to my-file at the commit tagged by v0.1.0
git checkout - # go back to where you were previously checked out
```

## Caveats

While this can create a permalink for any commit, that permalink will
return a 404 error if the commit is not pushed. This extension doesn't
handle pushing commits for you, so you'll need to do that yourself if
you want to create a permalink to a file that may be ahead of the remote.