1. Revert uncommitted changes

    You can always undo the changes you've done locally before you have committed them:

    1. Open the Version Control tool window (Alt+9) and switch to the Local Changes tab.
    2. In the active changelist, select one or more files that you want to revert, and select Revert from the context menu, or press Ctrl+Alt+Z. All changes done to the selected files since the last commit will be undone, and they will disappear from the Local Changes view.

    Undo the last commit

    IntelliJ IDEA allows you to undo the last commit in the current branch (i.e. HEAD):

    You cannot undo a commit if it was pushed to a protected branch, i.e. a branch to which push --force is not allowed. You can configure the list of protected branches in the Settings dialog (Ctrl+Alt+S) under Version Control | Git.

    1. Open the Version Control tool window (Alt+9) and switch to the Log tab.
    2. Select the last commit in the current branch and choose Undo Commit from the context menu.
    3. In the dialog that opens, select a changelist where the changes you are going to discard will be moved. You can either select an existing changelist from the Namedrop-down list, or specify the name of a new changelist (the commit message is used by default).
    4. Select the Set active option if you want to make the changelist with the changes you are about to discard the active changelist.
    5. Select the Track context option if you want IntelliJ IDEA to remember your context and reload currently opened files in the editor when this changelist becomes active.

    Revert a pushed commit

    If you notice an error in a specific commit that has already been pushed, you can revert that commit. This operation results in a new commit that reverses the effect of the commit you want to undo. Thus, project history is preserved, as the original commit remains intact.

    1. Locate the commit you want to revert in the Log view, right-click it and select Revert from the context menu. The Commit Changes dialog will open with an automatically generated commit message.
    2. If the selected commit contains several files, and you only need to revert some of them, deselect the files you do not want to touch.
    3. Click Commit to commit a changeset that reverts changes to the selected files in this particular commit

      信息来自:https://www.jetbrains.com/help/idea/using-git-integration.html#revert-local-changes

IDEA git commit push revert的更多相关文章

  1. [Git] How to revert one file changes from one commit

    Many times we might changed one file which we don't intent to do... but it was too late, until we fo ...

  2. [Git] git revert ( revert commit 和 revert merge)

    转载自:http://blog.csdn.net/qinjienj/article/details/7621887 我们难免会因为种种原因执行一些错误的commit / push,git提供了reve ...

  3. git 命令的使用(一) add commit push pull

    一. commit 和 push 的区别 git作为支持分布式版本管理的工具,它管理的库(repository)分为本地库.远程库.git commit操作的是本地库,git push操作的是远程库. ...

  4. 02_创建Git仓库,克隆仓库,git add,git commit,git push,git pull,同行冲突,不同行冲突的结局方案,git mergetool的使用

    1 创建Git资源库,残酷目录信息 创建git资源库的命令: git init –bare 仓库名称 (其中-bare表示的意思是空的库的意思) 进入E:\software\repository\gi ...

  5. 如何解决无法成功git commit 和git push

    如何解决无法成功git commit 和git push 20155324王鸣宇.20155314刘子健 git add . 成功了 但是git commit无法实现. 我先尝试了卸载git 重新下载 ...

  6. Git commit/pull/push的操作步骤

    1.操作步骤需要严格执行如下顺序:commit->pull->push 2.commit:将代码提交到本地仓库. 3.pull:将远程仓库代码同步到本地仓库.如遇冲突,解决冲突,重复com ...

  7. Git CMD连接,管理(remote,add,commit,push)github repository

    git initmd testcd testgit statusgit add test  //git add test/a.txtgit status git remote add origin g ...

  8. git<Commit和Push的区别>

    git作为支持分布式版本管理的工具,它管理的库(repository)分为本地库.远程库. git commit操作的是本地库,git push操作的是远程库. git commit是将本地修改过的文 ...

  9. 简单的处理git add ,git commit,git push 脚本

    创建脚本lazygit.sh #!/bin/bash # 一次性处理git提交 #branch_name=`git symbolic-ref --short -q HEAD` branch_name= ...

随机推荐

  1. YTU 2776: 小壮的习惯

    2776: 小壮的习惯 时间限制: 1 Sec  内存限制: 128 MB 提交: 206  解决: 40 题目描述 小壮是一个英语初学者,一天,逗比的小壮看英语书,被其中的句子吸引了.他有个习惯,他 ...

  2. YTU 2715: 函数---判断某年某月某日是这一年中的第几天

    2715: 函数---判断某年某月某日是这一年中的第几天 时间限制: 1 Sec  内存限制: 128 MB 提交: 380  解决: 155 题目描述 在主程序(main)中输入某年某月某日,例如2 ...

  3. P3469 [POI2008]BLO-Blockade tarjan

    好久没发博客了啊!自我反省1s...今天再捡起来. 这个题是一道有一点特殊的tarjan,用tarjan维护子树大小,然后判断是否有边多次连接,(就是非树边),然后就进行乘法计算就行了. 具体在代码里 ...

  4. Tool:安全狗

    ylbtech-Tool:安全狗 安全狗,互联网安全品牌,云安全服务与解决方案提供商 .企业用户遍布互联网金融.电商.游戏.移动互联网.政府单位等多个行业. 1.返回顶部 1.   2. 2.返回顶部 ...

  5. yistack

  6. 【翻译】- EffectiveAkka-第二章(一)

    Actor使用模式 现在我们已经了解了可以创建的actor系统的不同类型,那么我们在编写基于actor的应用程序时,可以采用什么样的使用模式,以便避免出现常见错误呢? 下面就让我们看看其中使用模式. ...

  7. golang——常用内建函数

    (1)func len(v Type) int 返回长度,取决于具体类型:字符串返回字节数:channel返回缓存元素的个数: (2)func cap(v Type) int 返回容量,取决于具体类型 ...

  8. JS/JQuery操作DOM元素笔记

    原因 自己目前在搭建一个.NET Core的框架,正在构建权限这块的东西,今天设置权限界面,需要使用JavaScript操作DOM元素,记录一下. 页面大概是酱紫的(我使用的AdminLTE和LayU ...

  9. [转]linux grep命令

    转自:http://www.cnblogs.com/end/archive/2012/02/21/2360965.html 1.作用Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表 ...

  10. A* 寻路算法[转载]

    A* 寻路算法 转载地址:http://www.cppblog.com/christanxw/archive/2006/04/07/5126.html 原文地址: http://www.gamedev ...