5

我正在使用git-svn,我想更新到最新的 SVN HEAD。

当我打字git pull时,它说:

fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

我在这里读到我应该做类似的事情:

git checkout -b real-trunk remotes/trunk

但我不明白这个命令。是什么remote-trunk?在任何情况下,git都会出现错误:

fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'remotes/trunk' which can not be resolved as commit?

这是我的.git/config

$ cat .git/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[svn-remote "svn"]
        url = http://name.xyz.com/svn/trunk/project
        fetch = :refs/remotes/git-svn

另外,谁能告诉我如何恢复我在 git checkout 中所做的所有更改?我想回到新鲜的 SVN HEAD 版本。

4

1 回答 1

5

对于更新而不是“git pull”:

git svn rebase

我猜你已经有 refs/heads/master 对应你的 refs/remotes/git-svn,所以使用它,你不需要“real-trunk”。

“git checkout”不执行任何更改,它只是更改您当前的分支。您可以改回当前分支,但使用“git checkout your_previous_commit_or_branch”。

“git checkout -b branchname”创建一个新分支。要删除分支,请使用“git branch -D branchname”。

于 2012-05-24T18:11:58.687 回答