CLI
Reset Command
The reset
command performs a hard reset of your git repository while carefully preserving all files in the .codegen
directory. This is useful for undoing codemod changes while keeping your codemod implementations intact.
Usage
What it Does
When you run codegen reset
, it:
- Backs up all files in
.codegen
directory, preserving their content and staged/unstaged status - Performs a hard reset (
git reset --hard HEAD
) on the repository - Restores all
.codegen
files to their previous state, including their git staging status - Removes untracked files (except those in
.codegen
)
This is more sophisticated than git checkout .
as it:
- Preserves both staged and unstaged changes in
.codegen
- Handles deleted files correctly
- Removes untracked files (like
git clean
) while protecting.codegen
Examples
Reset after testing a codemod:
This command performs a hard reset and removes untracked files. Make sure you have committed any changes you want to keep outside of .codegen
.