git pull 时报错fatal: No remote repository specified.
$ git pull
fatal: No remote repository specified. Please, specify either a URL or a
remote name from which new revisions should be fetched.
复制代码
找不到对应库,可能库地址配置错误。
因为我之前设置了默认分支medicalcard
,又太久没pull过代码,该分支在远程库上已被删除,所以pull 失败。 解决方法:在\.git\config
中设置要重新设置默认分支
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "ds"]
url = http://git.daishujiankang.com:88/ds/tijian.git
fetch = +refs/heads/*:refs/remotes/ds/*
# 该分支已删除
-[branch "medicalcard"]
- remote = ds
- merge = refs/heads/medicalcard
+[branch "master"]
+ remote = ds
+ merge = refs/heads/master
复制代码
同理,远程库地址、默认push地址、默认合并地址都可以在这里进行设置
恢复某个版本误删文件
- 找到在是误删的版本号
git checkout <commit>
回退到该版本,此时会产生个以该版本号命名的临时分支- 找到该文件后,再
git checkout <commit>
到回退前的版本,此时会产生个以该版本号命名的临时分支 - 切换到
doctor_report
分支,再合并3中的临时分支
14922@DESKTOP-0LSVJK1 MINGW64 /c/wamp/www/tijian.git (report)
$ git checkout 48eddc2
Note: checking out '48eddc2'.
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 performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 28a52a046... 我的钱包接口更换
---
14922@DESKTOP-0LSVJK1 MINGW64 /c/wamp/www/tijian.git ((48eddc2ce...))
$ git checkout 97fdddf13
Previous HEAD position was 48eddc2ce... 优化录音toast图片更改方法
HEAD is now at 97fdddf13... [报告解读] 消息撤回功能
---
14922@DESKTOP-0LSVJK1 MINGW64 /c/wamp/www/tijian.git ((97fdddf13...))
$ git checkout doctor_report
Previous HEAD position was 97fdddf13... 恢复误删chat-input.less
Switched to branch 'doctor_report'
---
14922@DESKTOP-0LSVJK1 MINGW64 /c/wamp/www/tijian.git (doctor_report)
$ git merge 97fdddf13
Updating 7aea28c9e..97fdddf13
Fast-forward
.../common/component/chat-input/chat-input.less | 124 +++++++++++++++++++++
1 file changed, 124 insertions(+)
create mode 100644 apps/report/wechat_miniapp/compile/page/common/component/cha t-input/chat-input.less
复制代码