18
15

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.

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

18
15
2

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
18
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?