2014-12-03 36 views
0

我有一個mu源代碼樹的問題。當我在做某件事時,我的Mac崩潰了,並自動將它推送到我的回購中的某個分支。Mac崩潰時的源代碼樹問題

當我重新啓動我的mac我的主分支從這個本地回購中失蹤。

每當我試着提交更改,所以我可以換到不同的分支,我得到如下:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/fz/vqrlp05n24gcr0vdp92qyvfjvzfz2f/T/SourceTreeTemp.AlvKt1 
error: unable to resolve reference HEAD: No such file or directory 
fatal: cannot lock HEAD ref 
Completed with errors, see above 

它實際上不會犯什麼。

當我嘗試改變分支我得到:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree checkout 83382244_Sign_In_Person_Button_-_Update 
error: Your local changes to the following files would be overwritten by checkout: 
    file1 
    file2 
    file3 
    file4 
Please, commit your changes or stash them before you can switch branches. 
Aborting 
Completed with errors, see above 

而且這是不會改變的分支。

如果我試圖創建一個分支我越來越:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree branch test 
fatal: Failed to resolve HEAD as a valid ref. 
Completed with errors, see above 

當我在終端我得到以下運行git reset HEAD

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. 
Use '--' to separate paths from revisions, like this: 
'git <command> [<revision>...] -- [<file>...]' 

,當我運行git checkout master我得到:

warning: ignoring broken ref refs/heads/master. 
error: Your local changes to the following files would be overwritten by checkout: 
    file1 
    file2 
    file3 
    file4 
Please, commit your changes or stash them before you can switch branches. 
Aborting 

我很爲難:/

+0

聽起來最簡單的事情就是對本地文件進行備份,然後從您的倉庫中重新簽出項目。有可能是一種奇特的方式來解決這個使用各種git命令,但重新創建它可能會是最簡單的解決方案 – 2014-12-03 12:52:58

+0

是的,我認爲,問題是如果我做一個browser.plist和hostingservices.plist備份它只會重現問題不是嗎?我在網上某處讀到它可能是一個損壞的文件,儘管我的所有文件都可以打開完全正常:/ – Timothy 2014-12-03 13:33:28

+0

我不確定你的意思是「browser.plist」,但是如果你刪除了你的本地項目(或者將它移動到臨時空間),然後從遠程倉庫重新簽出,那麼項目應該處於良好狀態。然後,您可以重新創建您的更改(即將修改後的文件複製回來),它應該可以工作。 – 2014-12-03 13:37:23

回答

0

我一個人在我的辦公室,給我一隻手......我用下面的(從我的回購源文件夾)

git status 
git stash 

這些工作正常的都不是。所以,我做了以下內容:

cd .. 
rm -r src 
git clone "SSH clone URL" src 
git pull "SSH clone URL" 
git pull "SSH clone URL" master 
git push "SSH clone URL" master 
git checkout -b branch_name 
git pull "SSH clone URL" branch_name 

然後我不得不重新回到源代碼樹中,選擇我的主分支,找到我需要能夠通過使用之間進行切換相關的分支「跳轉到:」下拉菜單在頂部。

一旦找到我不得不雙擊圖中的分支,檢出遠程分支..重複這些,我需要在我的源代碼樹中的所有分支...

不知道這是一個漫長的囉嗦的方式,但它的工作!