push到自己仓库的代码不想要了,这时候回滚到历史版本再强制push,自己仓库的代码会丢失一些别人的提交,这时候需要从原始仓库拉代码,再push到自己的仓库。
1. 添加原始仓库远程仓库
git remote add upstream ssh://git@xxx.git
2. 从原始仓库获取代码
git fetch upstream
3. 合并新代码与本地代码(必要时解决冲突)
git merge upstream/分支名
4. 将新代码push到自己的仓库
git push origin
5. 删除远程仓库
git remote rm upstream