-
-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathstash
More file actions
executable file
·35 lines (32 loc) · 727 Bytes
/
Copy pathstash
File metadata and controls
executable file
·35 lines (32 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
#
# Stash all changes (including untracked), or run git stash will all arguments.
#
# - Stash all changes:
#
# `stash`
#
# - List stashed changes:
#
# `stash list`
#
# - Show stashed changes:
#
# `stash show`
#
# ---
# Based on git-friendly: https://github.com/git-friendly/git-friendly
#
# Author: Nick Plekhanov, https://plekhanov.me
# License: MIT
# https://github.com/nicksp/dotfiles
# Abort if this isn't a git repository
git rev-parse --is-inside-work-tree > /dev/null || exit $?
# If ran without arguments, stall all files, including untracked
if [ -z "$1" ]; then
echo "🐿️ Stashing changes…"
git stash --include-untracked
exit 0
fi
# Otherwise pass all arguments to git stash
git stash "$@"