1
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 1 year has passed since last update.

git pull origin <current branch> のエイリアスを作る

Posted at

現在のブランチのみを pull したい場合、毎回

git pull origin 現在のブランチ名

と入力するのが面倒だった。

現在のブランチ名は git rev-parse --abbrev-ref HEAD で取得できるが、これを単純にエイリアスに登録しても上手く動かない。

エイリアス登録・NG
git config --global alias.pullcurrent 'pull origin $(git rev-parse --abbrev-ref HEAD)'

以下のように、先頭に !git を指定したらちゃんと動いてくれた。

エイリアス登録・OK
git config --global alias.pullcurrent '!git pull origin $(git rev-parse --abbrev-ref HEAD)'
実行
git pullcurrent

参考

1
0
0

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
1
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?