我對文件進行了一些更改並提交它們。然後我結帳到一個較舊的分支。Git:爲什麼結賬到舊分支後,新的提交消失了?
之後,我發現我所做的所有更改都消失了,我所做的提交也消失了。
我如何找到我所做的所有更改?
編輯
這是從我的終端歷史複製:
$ git commit -m 'done clean FNAG Yishu'
[detached HEAD 8a67a04] done clean FNAG Yishu
3 files changed, 1121 insertions(+)
create mode 100644 data/data_afterClean/amazon_Revised.txt
create mode 100644 data/data_afterClean/epinions_Revised.txt
create mode 100644 data/data_afterClean/slideshare_Revised.txt
但是,當我嘗試push
錯誤發生:
$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
To https://github.com/xxx/xxx.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxx/xxx.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration variable
hint: to 'simple', 'current' or 'upstream' to push only the current branch.
等一下。是什麼讓你認爲這個提交消失了? –
你確定你在你認爲你做的那個分支上做了那個提交嗎? – Shahbaz
如果您沒有將分支與較新的更改合併到較舊的分支,它們將不可見,除非您切換回分支並使用較新的更改... – akluth