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. bitnami-redmine邮件告警配置

    配置 bitnami-redmine的配置文件与单纯的redmine配置文件可能并不相同,在这里我们需要打开一下配置文件: /opt/bitnami/apps/redmine/htdocs/confi ...

  2. 树莓派创始人访谈:我们是怎么让大家都成为DIY黑客的

    原文出处: Linux.CN 请记住它是为喜欢折腾的人准备的只要35美元的计算机 我永远不会忘记我第一次看到树莓派的情形.那个小巧的,信用卡大小的计算机,性能却足够强劲,可以作为一般家用PC,媒体中心 ...

  3. Windows下安装WebLogic

    WebLogic安装结束 以下是进入MyEclipse启动配置WebLogic

  4. 设计原则:多使用Specialized Types

    使用Specialized Types的好处: 可以服用:验证.计算. 更高的编程层次. 容易在UI层封装组件.

  5. URAL 1837. Isenbaev&#39;s Number (map + Dijkstra || BFS)

    1837. Isenbaev's Number Time limit: 0.5 second Memory limit: 64 MB Vladislav Isenbaev is a two-time ...

  6. nginx如何启用对HTTP2的支持 | nginx如何验证HTTP2是否已启用

    nginx启用HTTP2特性 查看当前nginx的编译选项 1 #./nginx -V 2   3 nginx version: nginx/1.9.15 4 built by gcc 5.4.0 2 ...

  7. java.io.IOException: Attempted read from closed stream解决

    在HttpClient请求的时候,返回结果解析时出现java.io.IOException: Attempted read from closed stream. 异常,解决 原因是EntityUti ...

  8. SharePoint 删除废弃站点步骤

    前言 在SharePoint的日常使用中,经常会有一些废弃的站点需要删除,比如测试站点或者不再使用的站点等,我们应该如何去删除这些站点呢?下面,我们就为大家介绍. 正文 进入SharePoint服务器 ...

  9. 波吉亚家族第一季/全集The Borgias 1迅雷下载

    波吉亚家族 第一季 The Borgias Season 1 (2011)本季看点:<波吉亚家族>是一个非常复杂的故事,是现代人描绘这个臭名昭著的王朝家族过往历史的一副有趣又坦率的肖像画. ...

  10. 使用Spire.Office for .NET(Word、Excel、PPT、PDF等)的初步感受

    前言 本文大部分内容来自http://www.codeproject.com/Articles/710747/First-thoughts-on-Spire-Doc-for-NET. 针对我个人来说, ...