0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

「github cliのコマンドを`git ~`でタイポする」問題の解決法

Last updated at Posted at 2021-04-24

こんなことありませんか?

issueのリストとってきたろ!
$ git issue list
> git: 'pr' is not a git command. See 'git --help'. # ア゛ア゛ア゛ア゛ア゛

tldr

.gitconfigに⬇を追記

gitconfig
[alias]
    issue = !"f() { local s=$1; shift; \
      while [ $# -gt 0 ]; do s=\"$s $1\"; shift; done;\
      gh issue $s; }; f"

解決法(失敗)

fishを使っているのでabbrでやろうとした。

config.fish
$ abbr "git issue" "gh issue"
> abbr --add: Abbreviation 'git issue' cannot have spaces in the word

スペース込はできないらしい。

解決法(あまりうれしくない)

alias gis "git issue"

打ち慣れてないコマンドを新しく覚えたくない(怠惰)

解決法

.gitconfigに以下を追記。(dotfileで管理したかったので私は~/dotfiles/.gitconfig_sharedに書いてます)

gitconfig
[alias]
    issue = !"f() { local s=$1; shift; \
      while [ $# -gt 0 ]; do s=\"$s $1\"; shift; done;\
      gh issue $s; }; f"

嬉しくなったのでissueだけじゃなくてprとかも登録しました。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?