Skip to content

Instantly share code, notes, and snippets.

@renzocastro
Created February 10, 2021 20:29
Show Gist options
  • Select an option

  • Save renzocastro/dd3aaee88d3c6ecc477fcab4a7b261d8 to your computer and use it in GitHub Desktop.

Select an option

Save renzocastro/dd3aaee88d3c6ecc477fcab4a7b261d8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Reference: https://stackoverflow.com/a/59874960
if [ $# -eq 0 ]; then
git stash push -- $(git diff --staged --name-only)
else
git stash push -m "$@" -- $(git diff --staged --name-only)
fi
set --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment