Undo-Changes Throw away unsaved changes and return the working area to its last saved state.
Description
Undo-Changes is the GitEasy-first way to abandon every unsaved edit. Because the operation is destructive, the command refuses to run without explicit confirmation: pass -Force, or accept the standard PowerShell -Confirm prompt.
For a softer alternative, Save-Work -NoPush will save the current state locally first, so you can recover later if you change your mind.
Each invocation writes a self-contained diagnostic log file. Successful runs log silently; failures throw a plain-English message and point at the log file with the technical detail.
Recipes
Recipe 1
EXAMPLE 1
Find-CodeChange; Undo-Changes -Force
Recipe 2
EXAMPLE 2
Save-Work 'checkpoint before undo' -NoPush; Undo-Changes -Force
Notes
Safety:
- Always run Find-CodeChange first to see what will be discarded.
- Use Save-Work -NoPush for a recoverable checkpoint before undoing.
- Refuses to run during an unfinished merge, rebase, cherry-pick, revert, or bisect.
- Refuses to run while there are unfinished conflicts.
Parameters
-Force optional SwitchParameter
Skip the confirmation prompt and discard unsaved changes immediately.
-LogPath optional String
Override the directory where the diagnostic log for this run is written.
-WhatIf optional SwitchParameter
-Confirm optional SwitchParameter
Was this page helpful? Report an issue or suggest an improvement →