·设为首页收藏本站📧邮箱修改🎁免费下载专区🔐设置/修改密码👽群雄群聊
返回列表 发布新帖

git常见问题集锦

332 2
发表于 2020-7-6 08:07:52 | 显示全部楼层 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
You asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.

解决方法:
Edit your .git/config
  1. [branch "master"]  remote = origin  merge = refs/heads/master
复制代码
error: Your local changes to the following files would be overwritten by merge:
nbproject/private/private.xml
Please, commit your changes or stash them before you can merge.
Aborting

解决方法:
http://blog.csdn.net/lincyang/article/details/21519333

1.stash
通常遇到这个问题,你可以直接commit你的修改;但我这次不想这样。
看看git stash是如何做的。
  1. <div>git stash</div><div>git pull</div><div>git stash pop</div>
复制代码

接下来diff一下此文件看看自动合并的情况,并作出相应修改。
git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。
git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。
git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。

2.放弃本地修改,直接覆盖之
  1. <div>git reset --hard</div><div>git pull</div>
复制代码
error: Untracked working tree file 'public/images/icon.gif' would be overwritten by merge.
需要执行下面的命令才能修复:


git reset --hard HEAD   
git clean -f -d   
git pull  
我要说一句 收起回复
一花一世界,一叶一追寻。一曲一场叹,一生为一人。

评论2

拾光Lv.8 发表于 2020-7-6 08:08:52 | 显示全部楼层
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

解决方案:
  1. rm -f ./.git/index.lock
复制代码
我要说一句 收起回复
IT618发布Lv.8 发表于 2020-7-6 08:09:42 | 显示全部楼层
  1. There is no tracking information for the current branch.Please specify which branch you want to merge with.See git-pull(1) for details    git pull <remote> <branch>If you wish to set tracking information for this branch you can do so with:    git branch --set-upstream-to=origin/<branch> master
复制代码


看到第二个提示,我们现在知道了一种解决方案。也就是指定当前工作目录工作分支,跟远程的仓库,分支之间的链接关系。<br>
<br>
比如我们设置master对应远程仓库的master分支<br>
<br>
git branch --set-upstream master origin/master<br>
<br>
这样在我们每次想push或者pull的时候,只需要 输入git push 或者git pull即可。<br>
<br>
在此之前,我们必须要指定想要push或者pull的远程分支。<br>

git push origin master<br>

git pull origin master.<br>
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图

您的IP:18.222.200.143,111.174.9.73,GMT+8, 2024-5-2 10:28 , Processed in 0.184084 second(s), 89 queries , Gzip On, Redis On.

Based on Discuz! W1.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表