LoginSignup
15

More than 5 years have passed since last update.

Gitで特定のローカルブランチをリモートブランチの変更に追従させるワンライナー

Last updated at Posted at 2014-02-20

例えばあるブランチをレビューした後,更に他の人がそのブランチに変更を加えたとき&既にfetchしているとき.
git reset --hard @{u}

(もちろんfetchもしたいときはgit pull --rebaseすればok :ok_woman: )

@{u}?

<branch name>@{upstream}はそのブランチに対応したupstreamのブランチ名を取得する.
ここでbranch nameを省略すると現在のブランチを表し,また@{upstream}@{u}と省略できる.

参考

git help rev-parse

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
15