Git采坑小计

作者: ArtisticYouth | 来源:发表于2019-03-25 21:13 被阅读4次

1. remote: HTTP Basic: Access denied

图片.png

https://blog.csdn.net/Mocarcher/article/details/82849358
git config --system --unset credential.helper

邮箱号一致,设置密码最好也一致;

2. 解决冲突心得:

  1. 保留自己写的代码
  2. git checkout team/master
  3. git fetch team master git log 记下最新的commitid
  4. git checkout origin master git reset --hard commitid git push origin master -f

detected head :解决办法 git checkout -b 【new】 git -am commit "comment" git merge 【new】
git reset --hard f552a0f9e7d1fa6c0b4f3cef570b18562d447cd5
git push origin master --force

https://www.cnblogs.com/lihow/p/8903361.html

HEAD detached from XXXX解决方法
1.git push origin master后出现“Everything up-to-date”,重新提交了一次,在 git commit之后出现HEAD detached from 4d1722c错误,立即用git status查看,也是这样的内容。

2.具体的做法如下

git reflog 找到需要恢复的commit ,记下前面的commit id
git branch temp efa64f5 新建一个名字叫temp的分支,用这个分支代替之前的临时分支并且拥有想要恢复的commit,efa64f5为要恢复的commit id
git push origin temp推送到仓库
git checkout master切换到主分支
git merge temp 将temp合并到master
保险起见,先git push origin master 推送到仓库
查看是否更新,若更新则git branch -d temp删除该分支

相关文章

网友评论

    本文标题:Git采坑小计

    本文链接:https://www.haomeiwen.com/subject/zowfmqtx.html