简体   繁体   中英

checkout branch become checkout file

Shell output:

Wener@Wener-PC /web/learn/angular/learn/angularjs-book
$ git branch --l
* forAnyOption
  forRawgithub
  master
  myMatser

Wener@Wener-PC /web/learn/angular/learn/angularjs-book
$ git co master
切换到分支 'master'

Wener@Wener-PC /web/learn/angular/learn/angularjs-book
$ git co myMaster
error: pathspec 'myMaster' did not match any file(s) known to git.

Wener@Wener-PC /web/learn/angular/learn/angularjs-book
$ git checkout myMaster
error: pathspec 'myMaster' did not match any file(s) known to git.

$ git --version
git version 1.8.3.4

How to change branch directly ?

typo in

$ git branch --l * forAnyOption forRawgithub master myMatser

matser != master

The name in the list of branches is myMatser and you're trying to check out myMaster ...

In this case, git checkout myMatser is what you'll want to do.

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