🖥

Git | Rebase current branch into "latest master" with one co

2019/04/16に公開

Answer

It is good to register an alias in .gitconfig.

 [alias] new-world = !git checkout master && git pull origin master && git checkout - && git rebase master 

with this.

Just type $ git new-world You can easily follow the latest master. (If there is no conflict)

Explanation of command

Multiple commands are executed in order.

$ git checkout master

=> Check out to master.

$ git pull origin master

Bring the master up to date.

$ git checkout -

Return to work branch.

$ git rebase master

Make the working branch follow the master.

command

$ git new-world

Motive

March 2016. There is a specification change in GitHub.

The branch is not up-to-date. I had to press the Update Branch button on the screen.

Because of this, it was tempting to keep the working branch up-to-date.

environment

  • Github (as of March 7, 2016)
  • git version 2.3.8 (Apple Git-58)

Original by

Git | 現在のブランチを1コマンドで「最新のマスター」にリベースする

About

About this translattion

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-04-16

Discussion