Skip to content

Instantly share code, notes, and snippets.

@ihincks
Created December 11, 2018 13:56
Show Gist options
  • Save ihincks/5256a9d7ca9b4c6d80043d522eb14b47 to your computer and use it in GitHub Desktop.
Save ihincks/5256a9d7ca9b4c6d80043d522eb14b47 to your computer and use it in GitHub Desktop.
Saves a diff of the current working changes to a git repo into Dropbox (so that you can continue working on something somewhere else)
#!/bin/bash
timestamp() {
date +"%Y-%m-%d_%H:%M:%S"
}
pushd "$PWD" > /dev/null
SHA="$(git rev-parse --short HEAD)"
FILENAME="$HOME/Dropbox/diff/${PWD##*/}_$(timestamp)_$SHA.diff"
git diff > $FILENAME
echo "Saved diff to $FILENAME"
popd > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment