GIT-RESET(1) Git Manual GIT-RESET(1) (NAME) git-reset - HEAD (SYNOPSIS) git reset [--ft | --xed [-N] | -- git reset [-q] [] [--] ... git reset [-q] [--athspec-from-file= [--athspec-file-nul]] [] git reset (--atch | -p) [] [--] [...] (DESCRIPTION) git reset : 1. git reset [] HEAD . Git commit merge rebase pull . 2. --atch git reset ( ) . git reset [] [] (HEAD) . / . HEAD . ORIG_HEAD . ( --xed): --xed . HEAD . -N (intent-to-add) ( git-add?R(1) ). --ft . git reset --ft HEAD~5; git commit . . -- . . HEAD . --rge HEAD ( ) . git am -3 git switch -m . . --ep HEAD . HEAD . --ecurse-submodules, --0-recurse-submodules `--ecurse-submodules` HEAD (detached) . git reset [-q] [] [--] ..., git reset [-q] [--athspec-from-file= [--athspec-file-nul]] [] ( HEAD ) . git reset git add : () (unstage). git restore --aged .... git reset ( HEAD ). git- restore(1) . git reset (--atch | -p) [] [--] [...] ( HEAD ) . . git reset -p git add -p . --atch "Interactive Mode" git-add(1) . "Reset, restore and revert" git(1) . (OPTIONS) -q, --quiet . --efresh, --0-refresh mixed. . --athspec-from-file= (pathspec) . - . pathspec LF CR/LF . pathspec core.quotePath ( git- config(1)). --athspec-file-nul -- . --athspec-file-nul --athspec-from-file . pathspec NUL ( ) . -U, --nified= diff (context). diff.context . ( -U -p ). --inter-hunk-context= diff (hunks) . diff.interHunkContext . -- . ... . pathspec gitglossary(7) . (EXAMPLES) add $ edit (1) $ git add frotz.c filfre.c $ mailx (2) $ git reset (3) $ git pull git://info.example.com/ nitfol (4) 1. . git diff . 2. pull . 3. ( HEAD ). pull frotz.c filfre.c . . 4. pull merge frotz.c filfre.c . $ git commit ... $ git reset --ft HEAD^ (1) $ edit (2) $ git commit -a -c ORIG_HEAD (3) 1. . "reset" . 2. . 3. "reset" .git/ORIG_HEAD . -C . --mend git-commit(1) . $ git branch topic/wip (1) $ git reset -- $ git switch topic/wip (3) 1. master . topic/wip HEAD . 2. master . 3. topic/wip . $ git commit ... $ git reset -- 1. (HEAD HEAD^ HEAD~2) . . ( "RECOVERING FROM UPSTREAM REBASE" git-rebase(1) ). (merge) (pull) $ git pull (1) Auto-merging nitfol CONFLICT (content): Merge conflict in nitfol Automatic merge failed; fix conflicts and then commit the result. $ git reset -- $ git pull . topic/branch (3) Updating from 41223... to 13134... Fast-forward $ git reset -- 1. upstream . 2. "pull" git reset -- 3. fast-forward . 4. . "pull" "merge" ORIG_HEAD . pull $ git pull (1) Auto-merging nitfol Merge made by recursive. nitfol | 20 +++++---- ... $ git reset --rge ORIG_HEAD (2) 1. git pull . 2. . git reset -- . . $ git switch feature ;# you were working in "feature" branch and $ work work work ;# got interrupted $ git commit -a -m "snapshot WIP" (1) $ git switch master $ fix fix fix $ git commit ;# commit with real log $ git switch feature $ git reset --ft HEAD^ ;# go back to WIP state (2) $ git reset (3) 1. . 2. WIP . 3. WIP snapshot WIP . WIP . git-stash(1) . . git reset . $ git reset -- frotz.c (1) $ git commit -m "Commit files in index" (2) $ git add frotz.c (3) 1. . 2. . 3. . . . $ git tag start $ git switch -c branch1 $ edit $ git commit ... (1) $ edit $ git switch -c branch2 (2) $ git reset --ep start (3) 1. branch1 . 2. branch2 ( git switch -c branch2 start) . 3. branch2 reset --ep . . . git reset git add -p git commit -c . $ git reset -N HEAD^ (1) $ git add -p (2) $ git diff --ached (3) $ git commit -c HEAD@{1} (4) ... (5) $ git add ... (6) $ git diff --ached (7) $ git commit ... (8) 1. . -N HEAD git add -p . 2. git add -p diff . diff "yes, include this" "No don't include this" "edit" . 3. git diff --ached . . 4. . -c . . HEAD@{1} HEAD ( ). git-reflog(1) . . 5. . 6. git add . 7. . git diff . 8. . (DISCUSSION) : git reset -- HEAD (target) . A B C D . A B HEAD C target D git reset --ft target A B . HEAD ( ) target ( D ) ( ). working index HEAD target working index HEAD --------------------------------------------------- A B C D --ft A B D --xed A D D -- --rge (disallowed) --ep (disallowed) working index HEAD target working index HEAD --------------------------------------------------- A B C C --ft A B C --xed A C C -- --rge (disallowed) --ep A C C working index HEAD target working index HEAD --------------------------------------------------- B B C D --ft B B D --xed B D D -- --rge D D D --ep (disallowed) working index HEAD target working index HEAD --------------------------------------------------- B B C C --ft B B C --xed B C C -- --rge C C C --ep B C C working index HEAD target working index HEAD --------------------------------------------------- B C C D --ft B C D --xed B D D -- --rge (disallowed) --ep (disallowed) working index HEAD target working index HEAD --------------------------------------------------- B C C C --ft B C C --xed B C C -- --rge B C C --ep B C C git reset --rge . . target . --rge . git reset --ep . . HEAD HEAD target . . : working index HEAD target working index HEAD --------------------------------------------------- X U A B --ft (disallowed) --xed X B B -- --rge B B B --ep (disallowed) working index HEAD target working index HEAD --------------------------------------------------- X U A A --ft (disallowed) --xed X A A -- --rge A A A --ep (disallowed) X U . (GIT) git(1) Git 2.55.0 2026-06-29 GIT-RESET(1)