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. 如何运行Hadoop自带的例子

    bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.4.jar wordcount /WordCount/WordC ...

  2. Task.Delay方法的2个应用实例,单元测试等待,限时限次下载远程资源

    如果想让程序异步等待一段时间,可以考虑使用Task.Delay方法. 比如,在单元测试中模拟一个异步操作. static async Task<T> DelayedResult<T& ...

  3. C#中一种替换switch语句更优雅的写法

    今天在项目中遇到了使用switch语句判断条件,但问题是条件比较多,大概有几十个条件,满屏幕的case判断,是否有更优雅的写法替代switch语句呢? 假设有这样的一个场景:商场经常会根据情况采取不同 ...

  4. 在ASP.NET MVC中使用Knockout实践09,自定义绑定

    Knockout真正强大之处在于绑定机制,通过data-bind属性值体现绑定,不仅可以绑定值,还可以绑定事件,甚至可以自定义绑定. 从一个例子看Knockou的绑定机制 假设想给一个button元素 ...

  5. NSZombie 详解 -僵尸对象

    1.什么是僵尸对象? 简而言之,就是过度释放的对象. 2.僵尸对象有什么特点? 如果一个对象a被变成了僵尸对象,那么,在进行下面的判断时,a是会被系统当成一个对象来进行判断的.但是,如果你使用a进行其 ...

  6. 读取 android sys/下的信息

    读取 android sys/下的信息 https://github.com/ruw/Internet-Services-projects/tree/master/OffloadPredictor/l ...

  7. android 读取 raw 中的文件。

    file.getParentFile().mkdir(); file.createNewFile(); InputStream inputStream = context.getResources() ...

  8. IT狂人第一至四季/全集The IT Crowd迅雷下载

    本季第一至四季 The IT Crowd (2006)看点:<IT狂人>史上最囧,最雷,最脑残,最出乎意料,最不按常理出牌的IT “精英们”登上银屏了.让超擅长收发邮件.单击和双击鼠标的I ...

  9. C#泛型委托Predicate、Action、Func

    Predicate Predicate泛型委托:表示定义一组条件并确定指定对象是否符合这些条件的方法.此委托由 Array 和 List 类的几种方法使用,用于在集合中搜索元素.通过查看源码发现 Pr ...

  10. 《Python计算机视觉编程》

    <Python计算机视觉编程> 基本信息 作者: (美)Jan Erik Solem 译者: 朱文涛 袁勇 丛书名: 图灵程序设计丛书 出版社:人民邮电出版社 ISBN:978711535 ...