変更を失わずに機能ブランチからマスターに切り替えようとしているので、git stash
マスターに切り替えようとしていますが、マスターは私の機能ブランチに移動しています。基本的:
<feature*> $ git status
# On branch feature
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: hay.md
<feature*> $ git rev-parse --short HEAD
737b183
<feature*> $ git rev-parse --short master
109b5f7 # This happens to be 4 commits ago
<feature*> $ git stash
Saved working directory and index state WIP on feature: 737b183 Some commit
HEAD is now at 737b183 Some commit
<feature> $ git rev-parse --short HEAD
737b183
<feature> $ git rev-parse --short master
737b183 # WAT??!!!
私は git-stash を誤解していますか? それともgit全体ですか?それとも、知覚と現実の対応の性質を誤解しているのでしょうか?
更新.
の場合でも同じことができることを発見しましたgit reset
。
<feature*> $ git status
# On branch feature
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: hay.md
<feature*> $ git rev-parse --short HEAD
737b183
<feature*> $ git rev-parse --short master
109b5f7
<feature*> $ git reset --hard HEAD
HEAD is now at 737b183 Some commit
<feature> $ git rev-parse --short HEAD
737b183
<feature> $ git rev-parse --short master
737b183 # Hm....
別のアップデート
リポジトリの1つの「インスタンス」でのみ発生しているため(正しいgit語彙がわかりません).git/
、. 応急処置の解決策は、レポを削除してリモートから再度複製することですが、なぜそれが起こっているのか知りたいです。
いくつかのより多くのもの
‹master› » git checkout feature
Switched to branch 'feature'
Your branch is ahead of 'master' by 1 commit.
(use "git push" to publish your local commits)
‹feature› » echo "Hay" >> hay.md
‹feature*› » cat .git/HEAD
ref: refs/heads/feature
‹feature*› » cat .git/refs/heads/master
93d9d14b0f298ed28cc1520905768281f32d0929
‹feature*› » cat .git/refs/heads/feature
51410c5dcd679b8cf57a7dce2d17be7bbd121923
‹feature*› » git stash
‹feature› » cat .git/HEAD
ref: refs/heads/feature
‹feature› » cat .git/refs/heads/master
51410c5dcd679b8cf57a7dce2d17be7bbd121923
‹feature› » cat .git/refs/heads/feature
51410c5dcd679b8cf57a7dce2d17be7bbd121923