问题
Often when using Git Gui I would like to reset/checkout a single file or just dismiss a hunk.
Is there a way to do this easily in Git Gui? If not, is there any particular reason that this feature is not available in Git Gui?
回答1:
I know this way:
- The changes must be unstaged
- Go to Tools -> Add
- Choose whatever name you'd like for your command, then in Command write
git checkout $REVISION -- $FILENAME
- Select (left-click) the file you want to checkout, without staging
- Choose from Tools the command you just created
The chosen file will be checked out to HEAD
revision
回答2:
I had a same problem. Just found it out: CTRL+J or Commit - Revert Changes
回答3:
- Select the file from the file list in the left sidebar.
- In the Menu bar, under Commit, Click "Revert Changes" in the dropdown list.
Alternatively, you can use the keyboard shortcut Ctrl+J to trigger the same action on Windows.
回答4:
Select the file you want to reset from the "Unstaged changes window". Then click Menù - Branch - Reset -
You will have the file before the changes you did as the last commit.
来源:https://stackoverflow.com/questions/20242880/how-do-i-discard-changes-for-a-file-in-git-gui