2016-03-15 57 views
-1

今天一切正常。Git commit無法在antivir scann和重啓後提交

Symantec/Antivir掃描並重新啓動計算機,之後我的工作區看起來像這樣。

有誰知道我能做什麼?
如何再次設置HEAD一次? 在本地路徑全部被刪除。

Problem

enter image description here enter image description here

+0

我不得不再次簽出項目,之後我將.git文件夾複製到原始項目中 - 事後一切正常。 – quma

回答

1

你總是可以再次克隆該項目得到庫中的最新代碼。

另一種選擇是執行fsck並從懸掛文件中恢復。

# Search for all uncommitted added files = dangling content 
git fsck --full 

# print out the content of the dangling content 
git show <SHA-1> 

如果內容簡單地COMMITED使用git reflog

更多信息以更詳細的可以在這裏找到:
How to move HEAD back to a previous location? (Detached head)


單行命令,違反成多行僅爲了可讀性

# You can try recovering a branch by resting your branch to the sha 
# of the commit found using a command like: 
git fsck --full --no-reflogs --unreachable --lost-found | 
    grep commit | cut -d\ -f3 | xargs -n 1 
    git log -n 1 --pretty=oneline > .git/lost-found.txt 

# Display the above commits 
git log -p <commit> 

# OR: 
git cat-file -p <commit>