1
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?

GitHubのリモートリポジトリに強制的にローカルのブランチを合わせる方法

Last updated at Posted at 2025-04-23

最近、マージ作業をしているのですが、その際、ローカルブランチがリモートと

バージョンがまったくあわなくなっていて、git pullをしても同期できないことがありました。

その際、以下のコマンドで、強制的にローカルブランチをリモートブランチと合わせることで解決することができました。

git reset --hard origin/main

少し強引かもしれませんが、困ったときは、このコマンドで仕切り直ししてもいいかもしれません。

今日は、ここまで。

この他にも、以下のブログで、プログラミングについて記事を上げています。
https://yamachan228.seesaa.net/

1
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
1
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?