LoginSignup
0
0

More than 3 years have passed since last update.

[remote rejected] master -> master (branch is currently checked out) 対策

Posted at

状況

master のあるデスクトップPCにネットワークのフォルダ共有して、ノートPCにcloneを作成しました。
ノートPCを持ち歩いて、現場環境でデバッグ・修正した結果をpushしてmasterに反映しようとしました。

失敗

以下のようなメッセージが出て失敗。

[remote rejected] master -> master (branch is currently checked out)

いろいろな記事を参考にさせていただきました。
この記事が適切でした。
git pushでremote rejectedと怒られた時にやったことメモ: Qiita

手順

1)デスクトップPC(master)側

git config --bool core.bare true

2)ノートPC側

git push origin master

3)デスクトップPC(master)側

git config --bool core.bare false

ここで、Gitにステージングされている変更は、2)-1)の変更。
つまり、ノートPCで変更した内容をもとに戻す内容になってしまいます。

4)デスクトップPC(master)側
ステージングされた変更を取り消し破棄

・・・

3)、4)の手順が書いてある記事がなかったので、投稿してみました。

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