Git報(bào)錯(cuò)error:pathspec‘XXX‘did not match any file(s) known to git問題及解決過程
問題復(fù)現(xiàn)
① 在本地分支切換到同事新創(chuàng)建的分支:
git checkout xxx
② 報(bào)錯(cuò):
error: pathspec 'XXX' did not match any file(s) known to git
解決方法
① 查看本地的所有的分支中是否有同事新創(chuàng)建的分支:
git branch -a
② 如果沒看到,那么執(zhí)行以下操作,這步是獲取所有分支:
git fetch
③ 執(zhí)行完會(huì)看到這樣提示:
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
Unpacking objects: 100% (4/4), 1.06 KiB | 90.00 KiB/s, done.
From codeup.aliyun.com:5eeb0689892c58bb7c394ab5/pxb/pxb-fronted
* [new branch] XXX -> origin/XXX
④ 切換到遠(yuǎn)程同事分支:
git checkout origin/XXX
提示:
Note: switching to 'origin/XXX'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at dc877cd XXX
⑤ 現(xiàn)在可以看到自己的分支是一串?dāng)?shù)字字母,這時(shí)新建并切換到同事的分支:
git checkout -b XXX
⑥ 現(xiàn)在需要跟遠(yuǎn)程的同事分支進(jìn)行關(guān)聯(lián):
git branch -u origin/XXX XXX
⑦ 這時(shí)我們執(zhí)行g(shù)it pull來看看什么反饋:
git pull
Already up-to-date.
⑧ 此時(shí),可以如果修改了代碼后,需要進(jìn)行的操作就是:
查看修改狀態(tài):git status -s 添加到本地暫存區(qū):git add ./ 添加到本地倉庫:git commit -m "[ADD]新增了某功能" 添加到遠(yuǎn)程倉庫,遠(yuǎn)程倉庫中會(huì)多一個(gè)分支xxx:git push origin xxx
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- npm run serve運(yùn)行vue項(xiàng)目時(shí)報(bào)錯(cuò):Error: error:0308010C:digital envelope routines::unsupported的解決方法
- git?clone報(bào)錯(cuò)SSL?connect?error解決
- python解決報(bào)錯(cuò)ImportError: Bad git executable.問題
- vue-cli-service serve報(bào)錯(cuò)error:0308010C:digital envelope routines::unsupported
- Vue報(bào)錯(cuò)error:0308010C:digital?envelope?routines::unsupported的解決方法
相關(guān)文章
Web 設(shè)計(jì)與開發(fā)者必須知道的 15 個(gè)站點(diǎn)
今天讀到一篇文章,介紹了15個(gè)對(duì) Web 設(shè)計(jì)與開發(fā)師極端有用的站點(diǎn),里面有不少也是我們一直在使用的,也許對(duì)很多人都有用,翻譯出來以餉同仁。2009-08-08