Git错误non-fast-forward后的冲突解决当要push代码到git时,出现提示: error:failed to push some refs to ... Dealing with “non-fast-forward” errorsFrom time to time you may encounter this error while pushing: 问题(Non-fast-forward)的出现原因在于:git仓库中已经有一部分代码,所以它不允许你直接把你的代码覆盖上去.于是你…
当要push代码到git时,出现提示: error:failed to push some refs to ... Dealing with “non-fast-forward” errorsFrom time to time you may encounter this error while pushing: $ git push origin master To ../remote/ ! [rejected]        master -> master (non-fast forwar…
快捷操作: 切换并创建分支: git checkout -b 分支名. git checkout -b some-change 然后我打开某个文件(index.html)修改一下标题. Commit之后查看历史纪录, 可以看到再some-change分支里, 修改了index.html的title. 如果我想要把这个commit合并到master分支. 首先要切换回到master分支: git checkout master 然后, 我需要知道发生了哪些变化, 也就是比较这两个分支: git d…
作者:故事我忘了¢个人微信公众号:程序猿的月光宝盒 0.记一次使用git push后,覆盖了同事代码的糗事 前言: ​ 都在WebStorm中操作,Idea或者PyCharm同理 ​ 为了高度还原尴尬现场,这里在原有项目上新建分支,然后都在分支上操作,一方面怕自己搞炸了,一方面真实环境就是如此 1.还原案发现场的准备工作 1.1 新建分支 注意: 这里创建的分支仅仅在本地仓库 1.2. 分支提交到远程Git仓库 远程查看确认,确实有,说明分支已经创建 2.糗事发生契机 ​ 这时候别人可能会和你改…
git merge --no-ff -m "msg" x-branch:禁用Fast forward的普通合并 通常,合并分支时,如果可能,Git会用Fast forward模式,但这种模式下,删除分支后,会丢掉分支信息(即:原来这个分支的做了什么在log中体现不出来). 为了保留原来的分支,即:普通合并,这样的话,merge的时候会提交一个commit,就会输入-m参数,在log中体现的也更清晰! 前面我们解决冲突的时候发现,我们解决冲突之后,即使 是在master主分支上合并dev…
错误提示: error: The requested URL returned error: 403 Forbidden while accessing https://nanfei9330@github.com/nanfei9330/newsPM2.git/info/refs 解决方案,进入项目目录 vim .git/config fetch = +refs/heads/*:refs/remotes/origin/*        url=https://github.com/yourid/e…
背景:同一台电脑的public key同时添加到了github的两个账户,导致user1的仓库没法正常提交. 解决办法:为两个账户分别配置ssh key,配置~/.ssh/config文件(windows下也是这个路径,在git bash中可以识别~) 错误: $ git push remote: Permission to user1/python.git denied to user2. fatal: unable to access 'https://github.com/user1/py…
--> git push Counting objects: 81, done.Delta compression using up to 4 threads.Compressing objects: 100% (50/50), done.^Citing objects:  64% (52/81), 1.96 MiB | 75.00 KiB/s 此错表示提交的文件超过git接收文件上限.此时是已经取消不了,只能回滚到前版本再次提交. git log 查看提交的版本,找到版本号进行回滚. 回滚命令…
一.基础使用 1.初始化本地仓库 git init 2.关联远程仓库 git remote add origin git@github.com:用户名/仓库名.git 3.添加远程仓库文件到本地 git pull origin master 本地自动创建master分支用于跟踪远程origin/master分支 4.创建本地分支 $ git checkout -b 新的分支名Switched to a new branch "新分支名" 和以下效果等价 $ git branch 新分支…
一.Git冲突解决 在idea开发工具中使用Git时,主要用到的快捷按钮如下五个:   这五个按钮的使用说明及在idea中如何配置和使用git可参考https://github.com/DayThink/IntelliJ-IDEA-Tutorial/blob/newMaster/vcs-introduce.md 本文主要讲解在Idea中利用git遇到的两种冲突(提交代码时发生冲突和更新代码时发生冲突)以及解决方法,无论是那种冲突,只要发生冲突了,idea都会弹出一个图形化的merge对话框,在m…