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

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

Last updated at Posted at 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オープンチャットもご利用ください。

Twitter

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?