If we pushed our changes already to the remote repository we have to pay attention to not change the git history (using commands like rebase, reset, amend etc). Other collaborators of the same repository might already have pulled your changes, thus resulting into horrible, strange merge conflicts if we change the git history. There are some “safer commands” for undoing in such cases.

If you push something we shouldn't push to git, we can revert it:

First, using git log to get the commit id you want to revert, then using:

git revert <commit_id>

Then push to git

[Git] Undo a commit that has already been pushed to the remote repository的更多相关文章

  1. 【git基础】Permission denied (publickey). fatal: Could not read from remote repository

    运行以下git命令的时候出现错误 git push -u origin master error The authenticity of host 'github.com (13.250.177.22 ...

  2. git undo last commit

    $ git commit -m "Something terribly misguided" (1) $ git reset --soft HEAD~ (2) << e ...

  3. 使用Git出现以下错误"Git@github.com: Permission denied (publickey). Could not read from remote repository."解决方案

    转载于:https://blog.csdn.net/dotphoenix/article/details/100130424 git@github.com: Permission denied (pu ...

  4. [Git] Undo my last commit and split it into two separate ones

    When you accidentally committed some changes to your branch you have various possibilities to “undo” ...

  5. Git error on commit after merge - fatal: cannot do a partial commit during a merge

    Git error on commit after merge - fatal: cannot do a partial commit during a merge this answer is : ...

  6. Git 合并多次 commit 、 删除某次 commit

    Git 合并多次 commit 有时候在一个分支的多次意义相近的 commit,会把整个提交历史搞得很混乱,此时可以将一部分的 commit 合并为一个 commit,以美化整个 commit 历史, ...

  7. [Git/GitHub] Tutorial 1. Git download and commit first project

    1. Install at https://git-scm.com/downloads 2. Set up your name and email $ git config --global user ...

  8. Git冲突:commit your changes or stash them before you can merge.

    用git pull来更新代码的时候,遇到了下面的问题: error: Your local changes to the following files would be overwritten by ...

  9. [Git] Change the commit message of my last commit

    Did you make a typo in your last commit message? No problem, we can use the git --amend command to c ...

随机推荐

  1. LINUX 源码+内核所有参数说明

    http://www.cnblogs.com/tolimit/p/5065761.html

  2. List、Set、Map 和 Queue 之间的区别

    list 和set 有共同的父类 它们的用法也是一样的 唯一的不太就是set中不能有相同的元素 list中可以list和set的用途非常广泛 list可以完全代替数组来使用map 是独立的合集 它使用 ...

  3. 看书小记6(《C专家编程》)

    typedef不常见但值得一提的用途: 1. 用typedef来定义与平台无关的类型. 比方定义一个叫 REAL 的浮点类型.在目标平台一上.让它表示最高精度的类型为: typedef long do ...

  4. Calendar获取当天的初始时间,当月的初始时间,当年的初始时间

    如下:

  5. .Net Standard Http请求实例

    一 ..Net Standard http协议封装 程序集: System.Net.Http.dll 命名 空间:System.Net.Http HttpClient :http请求 发送类 Form ...

  6. SVG.js 元素操作整理(一)

    一.属性操作Attributes var draw = SVG('svg1').size(300, 300); //attr() 属性操作 //设置属性的值 var rect = draw.rect( ...

  7. Apache Ant 简介和配置

    Apache Ant 简介     Apache Ant是目前事实上的Java应用的标准build脚本工具.使它大受欢迎的一个主要愿意是它的和灵活,允许程序员创建自己的Task来对Ant进行扩展.   ...

  8. java.lang.NoClassDefFoundError: com.sap.conn.jco.JCo (initialization failure) java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path

    java.lang.NoClassDefFoundError: com.sap.conn.jco.JCo (initialization failure) at java.lang.J9VMInter ...

  9. verilog语法实例学习(10)

    常用的时序电路介绍 T触发器和JK触发器 在D触发器输入端添加一些简单的逻辑电路,可以生成另一种类型的存储元件.比如下图所示的T触发器.该电路有一个上升沿触发的触发器和两个与门,一个或门,以及一个反相 ...

  10. RV32C指令集

    Risc-V支持16位压缩格式,压缩格式立即数位数更少,能使用的寄存器也比较少,有些指令只能用常用8个整数寄存器(x8-x15)或者(f8-f15). 每个RVC指令都有对应的32位指令,下表列出所有 ...