7

几周前我用 git 创建了一个特性,并做了一些工作,不得不停下来。现在我想再次开始工作,但每次我git branch -a用来获取可用分支的名称时,我都可以看到它

remotes/origin/feature/upgrade-free-premium

但是当我运行时git checkout upgrade-free-premium出现以下错误。

error: pathspec 'upgrade-free-premium' did not match any file(s) known to git.

有人可以帮我解决这个问题吗?

4

4 回答 4

10

Try this:

git checkout -b upgrade-free-premium origin/feature/upgrade-free-premium

In your case, the branch is a remote one. You need to specify from which branch you want to checkout: so the correct branch name is origin/feature/upgrade-free-premium. This, because other origins can have the same branch name, so you need to specify the full name.

The -b is necessary to create a local branch to track the remote branch.

于 2013-01-17T01:36:53.730 回答
4

您的分支被命名feature/upgrade-free-premium('/' 可以是分支名称的一部分)。

git checkout feature/upgrade-free-premium改为运行。

于 2013-01-17T01:26:42.537 回答
1

我假设您的功能分支来自开发 1. git checkout develop 2. git pull 3. git checkout 4. git pull

于 2016-07-27T09:57:50.363 回答
1

我有同样的问题,我先做git pull然后解决它git checkout <feature>:)

于 2018-07-16T23:47:01.323 回答