Skip to content

Instantly share code, notes, and snippets.

@johnscott999
Last active January 29, 2021 19:41
Show Gist options
  • Save johnscott999/3c2ffd7c11868de2a0df4caa743f9d78 to your computer and use it in GitHub Desktop.
Save johnscott999/3c2ffd7c11868de2a0df4caa743f9d78 to your computer and use it in GitHub Desktop.
IDE - manual
#!/bin/bash
# read from pipe or arguments
if [ -t 0 ]
then
stash=$1
else
#read from piped input
stash=$(cat)
fi
if [ -f "$stash" ]
then
stash=$(cat "$stash")
fi
# if no value set, default to the first stash entry
if [ -z "$stash" ]
then
stash="stash@{0}"
fi
# input is an integer, format as stash entry
re='^[0-9]+$'
if [[ $stash =~ $re ]] ; then
stash="stash@{$1}"
fi
git stash list | grep -iF "$stash: " | cut -c$(echo -n "$stash: " | wc -m)-
#!/bin/bash
if [ -t 0 ]
then
stash=$1
else
stash=$(cat)
fi
if [ -z "$stash" ]
then
stash="stash@{0}"
fi
updated=$(git show "$stash" --name-only | awk -F: '{if(NR>7)print}' | wc -l)
new=$(git show "$stash^3" --name-only | awk -F: '{if(NR>6)print}' | wc -l)
echo "updated $updated"
echo "new $new\n"
git show "$stash" --name-only | awk -F: '{if(NR>7)print}'
git show "$stash^3" --name-only | awk -F: '{if(NR>6)print}'
git show -p "$stash"
git show -p "$stash^3"
#!/bin/bash
temp=$(mktemp)
# try/finally? need to make sure the temp gets killed
cat >> "$temp"
"C:\Program Files\Sublime Text 3\subl.exe" -w "$temp"
rm "$temp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment