zoukankan      html  css  js  c++  java
  • IDEA git commit push revert

      

    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
  • 相关阅读:
    mysql------Windows7 64bit安装教程------下载mysql
    [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher 问题--MyEclipse设置JDK版本
    码云Gitee上新建项目教程
    远程桌面无法复制粘贴
    Submine Text3格式化HTML/CSS/JS代码
    FTP上传文件,报错java.net.SocketException: Software caused connection abort: recv failed
    在MyEclipse使用Git新建分支,并上传分支---图文教程
    使用Git Bash上传代码到新的分支
    使用Git Bash从Git上下载代码到本地以及上传代码到码云Git
    安装Git Bash图文教程
  • 原文地址:https://www.cnblogs.com/mengjianzhou/p/7662313.html
Copyright © 2011-2022 走看看