Skip to content

Instantly share code, notes, and snippets.

@floffy-f
Created December 12, 2025 10:37
Show Gist options
  • Select an option

  • Save floffy-f/a79fd8398db29b324cbc72616da33528 to your computer and use it in GitHub Desktop.

Select an option

Save floffy-f/a79fd8398db29b324cbc72616da33528 to your computer and use it in GitHub Desktop.
Nushell+git: Unstage a specific set of files according to whether it was added by accident
gits --porcelain --untracked-files=no
| lines
| each {split column --regex '\s+'
| get 0.column2}
| filter {|x| $x =~ '<PLACEHOLDER put the pattern here>'}
| git restore --staged ...$in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment