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?
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?
I know this way:
git checkout $REVISION -- $FILENAME
The chosen file will be checked out to HEAD
revision
I had a same problem. Just found it out: CTRL+J or Commit - Revert Changes
Alternatively, you can use the keyboard shortcut Ctrl+J to trigger the same action on Windows.
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.
Revert Change will work with untracked files too, with Git 2.25 and git-gui
.
See commit 0d2116c (04 Jan 2020), commit 23cbe42 (19 Dec 2019), commit 1e1ccbf (06 Dec 2019), commit d32e065 (11 Dec 2019), and commit 2763530 (05 Dec 2019) by Pratyush Yadav (prati0100
).
See commit 786f4d2 (30 Dec 2019) by Zoli Szabó (zoliszabo
).
See commit 39acfa3 (07 Dec 2019) by Kazuhiro Kato (kkato233
).
See commit fa38ab6, commit d9c6469, commit 29a9366 (01 Dec 2019) by Jonathan Gilbert (jpg0
).
(Merged by Junio C Hamano -- gitster
-- in commit fe47c9c, 08 Jan 2020)
git-gui
: revert untracked files by deleting themSigned-off-by: Jonathan Gilbert
Signed-off-by: Pratyush YadavUpdate the
revert_helper
proc to check for untracked files as well as changes, and then handle changes to be reverted and untracked files with independent blocks of code.Prompt the user independently for untracked files, since the underlying action is fundamentally different (
rm -f
).
If after deleting untracked files, the directory containing them becomes empty, then remove the directory as well.Migrate unlocking of the index out of
_close_updateindex
to a responsibility of the caller, to permit paths that don't directly unlock the index, and refactor the error handling added in d4e890e5 so that callers can make flow control decisions in the event of errors.
Update Tcl/Tk dependency from 8.4 to 8.6 ingit gui
.sh.A new proc
delete_files
takes care of actually deleting the files in batches, using the Tcler's Wiki recommended approach for keeping the UI responsive.Since the
checkout_index
anddelete_files
calls are both asynchronous and could potentially complete in any order, a "chord" is used to coordinate unlocking the index and returning the UI to a usable state only after both operations are complete. TheSimpleChord
class, based on TclOO (Tcl/Tk 8.6), is added in this commit.