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

最新文章

  1. git 设置不需要输入密码
  2. 飘逸的python - 增强的格式化字符串format函数
  3. XML(DOM解析)
  4. uTenux\AT91SAM3S4C开发套件———硬件电路介绍
  5. Ext.net 异常统一管理,铥掉可恶的 Request Failure
  6. 钱币兑换问题_完全背包&&拆分&&母函数
  7. 取得DisplayMerics手机屏幕大小的应用
  8. hdu 3501 Calculation 2 (欧拉函数)
  9. Xcode中添加代码块的方式
  10. 存储过程系列之存储过程sql查询存储过程的使用
  11. 移动端rem布局的适配mixin【转藏】
  12. (LightOJ 1030)期望dp
  13. 概率图模型(PGM)学习笔记(四)-贝叶斯网络-伯努利贝叶斯-多项式贝叶斯
  14. Storyboard中ViewController加载的四种方式
  15. 吴裕雄 python 数据可视化
  16. 本地node启动服务步骤
  17. 深入浅出的webpack构建工具---webpack基本配置(一)
  18. hdu 2191 悼念512汶川大地震遇难同胞 【多重背包】(模板题)
  19. html介绍和head标签
  20. 【bzoj4676】 两双手

热门文章

  1. [1525] Cow Xor
  2. android 中activity 属性说明(转载)
  3. P4166 [SCOI2007]最大土地面积
  4. 自定义滚动条配合鼠标滚轮demo
  5. ckeditor 工具栏的配置
  6. RabbitMQ~消费者实时与消息服务器保持通话
  7. C#最实用的快捷键
  8. 软件图标显示不正常【win7企业版】
  9. Linq学习(五)-多表连接
  10. Linq学习(一)-初涉Linq