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.

Git ブランチを作ってリモートに push & 追跡 までをやってくれるエイリアス作った

Last updated at Posted at 2021-04-13

説明

ブランチを作るときに、git checkout -b して〜 git push origin HEAD して〜 が面倒くさかったので、エイリアスを作った。

登録するエイリアスコマンド

vi ~/.zshrc して以下のコマンドを追記&保存する

~/.zshrc
alias fd="git fetch origin develop:develop"
alias branchcreate='(){git checkout -b $1 && fd && git reset --hard origin/develop && git push origin HEAD && git branch -u origin/$1}'

終わったら反映コマンドを叩く

source ~/.zshrc 

使い方

以下のコマンドを叩くと最新化した develop からローカルにブランチを作ってリモートにプッシュ&追跡までをやってくれる

branchcreate feature/hogefuga
0
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
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?