简体   繁体   中英

How do I checkout a feature with git?

I created a feature a few weeks ago with git and did some work on it and had to stop. Now I want to start working on it again but each time I use git branch -a to get the name of the available branches I can see it as

remotes/origin/feature/upgrade-free-premium

but when I run git checkout upgrade-free-premium I get the following error.

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

Could someone help me solve this?

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.

Your branch is named feature/upgrade-free-premium ('/' can be part of the branch name).

Run git checkout feature/upgrade-free-premium instead.

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

我有同样的问题,我首先通过git pull然后git checkout <feature> :)解决了这个问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM