LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-undo

Undo recent commits while preserving changes

TLDR

Undo last commit
$ git undo
copy
Undo N commits
$ git undo [3]
copy
Undo and keep changes staged
$ git undo --soft
copy
Undo and discard changes
$ git undo --hard
copy

SYNOPSIS

git undo [count] [options]

DESCRIPTION

git undo removes the last commit(s) while keeping changes in the working directory (unstaged). It is a convenient wrapper around `git reset` that defaults to a mixed reset, preserving all work.Without arguments, it undoes the most recent commit. Pass a number to undo multiple commits. Use --soft to keep changes staged, or --hard to discard them entirely.

PARAMETERS

COUNT

Number of commits to undo (default: 1).
--soft
Keep changes staged.
--hard
Discard all changes.
--help
Display help information.

INSTALL

sudo apt install git
copy
sudo dnf install git
copy
sudo pacman -S git
copy
sudo apk add git
copy
sudo zypper install git
copy
brew install git
copy
nix profile install nixpkgs#git
copy

CAVEATS

Part of the git-extras package and must be installed separately. Only affects local commits that have not been pushed. --hard discards changes permanently and cannot be easily recovered.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid