Results for “Files & paths”
Small, practical examples. Search by task or narrow things down below.
Transform each item in a collection
Build a result array with a foreach expression.
foreach✓ Tested
Transform each pipeline value
PowerShell: Transform each pipeline value using PowerShell 7.
PowerShell✓ Tested
Trim whitespace around a string
PowerShell: The Trim method removes surrounding whitespace while preserving the middle of the string.
PowerShell✓ Tested
Turn JSON into typed rows
Project JSON array items into SQL columns.
OPENJSON✓ Tested
Uncommit a local change and leave its edits unstaged
Git: A mixed reset resets the index while retaining working-file contents.
Git✓ Tested
Uncommit the latest local change while keeping it staged
Git: A soft reset moves the branch tip but preserves both index and working files.
Git✓ Tested
Undo a commit with a new commit
Reverse a change while preserving shared history.
revert✓ Tested
Unstage a file while keeping its contents
Git: Unstage a file while keeping its contents inside the disposable repository created by the input setup.
Git✓ Tested
Unstage a file without losing edits
Return a staged change to the working tree.
restore✓ Tested
Use a build argument while creating an image
Docker / Compose: ARG supplies a build-time value that is not automatically a runtime environment variable.
Docker / Compose✓ Tested
Use a counted loop
PowerShell: Use a counted loop using PowerShell 7.
PowerShell✓ Tested
Use a fallback for a missing hashtable entry
PowerShell: Test the key explicitly so legitimate false or zero values are preserved.
PowerShell✓ Tested