LoginSignup
5
3

More than 5 years have passed since last update.

[Git] Gitの手で打つのめんどくさい系コマンドをpecoのカーソル選択で行う

Last updated at Posted at 2019-02-13

pecoの選択を使ってgitの手で打つのめんどくさい系コマンドを楽にする方法をご紹介します。
(コマンドを適宜aliasなどに設定して試してみてください)
pecoのインストールはこちら

git checkout {branch_name}

git branch | peco | xargs git checkout

利用イメージ
1__gco____Users_matsumotokazuya__ghq_github_com_otoshimono_mamorio-server__xargs_.png

git branch -d {branch_name}

git branch | peco | xargs git branch -d

git reset --soft {commit_hash}

git log --pretty=oneline | peco |  awk '{print $1}' | xargs git reset --soft

利用イメージ
1__git____Users_matsumotokazuya__ghq_github_com_otoshimono_mamorio-server__xargs_.png

git reset --hard {commit_hash} (:warning: hardなので利用注意)

git log --pretty=oneline | peco |  awk '{print $1}' | xargs git reset --hard

利用イメージ
--softと同じ

git stash apply {stash num}

git stash list | peco | awk -F '{|}' '{print $2}' | git stash apply

利用イメージ
1__git____Users_matsumotokazuya__ghq_github_com_kazuooooo_calendy-webapp__peco_.png

5
3
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
5
3