git reset

Git uses an index to stage changes. The index is committed on the next commit. Git allows you to revert back to the state of the last commit as well as to the state staged in the index.

Revert changes in the current file

To revert all changes and reset the current file to the state of the index, go to Tools > Git > Current File and select Undo Unstaged Changes for <file>.

To return the current file to the state it was in right after the last commit, select Undo Uncommitted Changes for <file>. This reverts all changes, discarding the index.

Reset changes in the local repository

To reset changes in the local repository, go to Tools > Git > Local Repository and select Reset.

Select the commit to reset the working directory to. This is useful after applying patches for review, for example.

Select the reset type:

  • Hard reset discards all changes to tracked files in the working tree.

    For more information about how to recover accidently removed commits, see git reflog.

  • Mixed reset undoes the selected commits and unstages all changes, but keeps the working tree unchanged.
  • Soft reset undoes the selected commits but keeps all staged changes and the working tree unchanged.

To recover removed files, select Recover Deleted Files.

See also How To: Use Git and Git.

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.