0
我一直在我的存儲庫上工作了一段時間,但最近在我的一個文件中收到了一個奇怪的狀態,我將其命名爲file.py
(我也將當前分支命名爲my_branch
)。我不確定是什麼讓GIT處於這種狀態,但我似乎可以解決它(不需要重新克隆整個項目)。 GIT現在似乎完全與我的改變相混淆,拒絕恢復舊的改變。硬復位問題
$ rm file.py
$ git reset --hard
HEAD is now at 42d1b0b Documentation for various modules.
$ ls | grep file.py
file.py
$ git status
On branch my_branch
Your branch is up-to-date with 'origin/my_branch'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: File.py
no changes added to commit (use "git add" and/or "git commit -a")
這裏一個小紙條,列出的git的狀態部分File.py
真的是大寫的某些原因。文件file.py
被拉下來作爲小寫。在這一點上,我只是感到沮喪,想回去工作,所以我試圖清理一切。
它又到了!運行git diff file.py
也會產生差異。但差異與我上次提交的相同。試圖添加文件並沒有幫助,因爲它默默地忽略了我的請求。
有什麼建議嗎?
你嘗試一個git結帳 - File.py? –
@MattPileggi是的,它不會不幸的。 – jakebird451
這很奇怪。如何備份file.py,做一個git rm file.py並將其添加回來? –