Mac崩溃时源树问题

时间:2014-12-03 11:11:18

标签: git github atlassian-sourcetree

我有mu源树的问题。当我提交一些东西并自动将它推到我的仓库中的一个分支时,我的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

我很难过:/

1 个答案:

答案 0 :(得分: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

然后我不得不回到源代码树,选择我的主分支,通过使用&#34;跳转到:&#34;找到我需要能够切换的相关分支。在顶部下拉。

一旦找到,我必须双击图中的分支并检查远程分支..重复这个我在源代码树中需要的所有分支......

不确定这是否是一个漫长的方式,但它有效!