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 5 years have passed since last update.

ブランチ名をコミットメッセージで使いたい時のコピーコマンド

Posted at

e.g.)
ブランチ名:feature/add_model_for_new_features

ターミナルに出力したい

コマンド:cm

alias cm="git symbolic-ref --short HEAD | sed -e 's/_/ /g' | sed -e 's/.*\///g'"
cm
# => add model for new features

クリップボードにコピーしたい

コマンド:cmp

クリップボードにコピーされるためcmd-vで"add model for new features"の貼り付けができる

alias cmp="git symbolic-ref --short HEAD | sed -e 's/_/ /g' | sed -e 's/.*\///g' | tr -d '\n' |pbcopy"
cmp

ブランチ名をコミットメッセージにしてコミット

コマンド:cmcm

もう一気にコミットまでしたい場合。

alias cmcm="git commit -a -m '`cm`'"
cmcm

aliasの設定

alias cm="git symbolic-ref --short HEAD | sed -e 's/_/ /g' | sed -e 's/.*\///g'"
alias cmp="git symbolic-ref --short HEAD | sed -e 's/_/ /g' | sed -e 's/.*\///g' | tr -d '\n' |pbcopy"
alias cmcm="git commit -a -m '`cm`'"
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?