IDEA git commit push revert
Revert uncommitted changes
You can always undo the changes you've done locally before you have committed them:
- Open the Version Control tool window (Alt+9) and switch to the Local Changes tab.
- 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.- Open the Version Control tool window (Alt+9) and switch to the Log tab.
- Select the last commit in the current branch and choose Undo Commit from the context menu.
- 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).
- Select the Set active option if you want to make the changelist with the changes you are about to discard the active changelist.
- 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.
- 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.
- 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.
- 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
最新文章
- git 设置不需要输入密码
- 飘逸的python - 增强的格式化字符串format函数
- XML(DOM解析)
- uTenux\AT91SAM3S4C开发套件———硬件电路介绍
- Ext.net 异常统一管理,铥掉可恶的 Request Failure
- 钱币兑换问题_完全背包&;&;拆分&;&;母函数
- 取得DisplayMerics手机屏幕大小的应用
- hdu 3501 Calculation 2 (欧拉函数)
- Xcode中添加代码块的方式
- 存储过程系列之存储过程sql查询存储过程的使用
- 移动端rem布局的适配mixin【转藏】
- (LightOJ 1030)期望dp
- 概率图模型(PGM)学习笔记(四)-贝叶斯网络-伯努利贝叶斯-多项式贝叶斯
- Storyboard中ViewController加载的四种方式
- 吴裕雄 python 数据可视化
- 本地node启动服务步骤
- 深入浅出的webpack构建工具---webpack基本配置(一)
- hdu 2191 悼念512汶川大地震遇难同胞 【多重背包】(模板题)
- html介绍和head标签
- 【bzoj4676】 两双手