Skip to content

Instantly share code, notes, and snippets.

@tw3
Created January 27, 2022 17:22
Show Gist options
  • Save tw3/ab4928e7e32bbad0de2b15979a8bd09d to your computer and use it in GitHub Desktop.
Save tw3/ab4928e7e32bbad0de2b15979a8bd09d to your computer and use it in GitHub Desktop.
Bash alias that does a git diff to see the files that have changed and creates a tarball of those files in a separate folder. Useful if you want to manually backup your diffs.
alias gdbak='GDBAK_FILENAME="../../temp/diff-bak-$(date +%s%3N)_$(git branch --show-current).tar"; tar cvf "${GDBAK_FILENAME}" `git diff --name-only`; echo "${GDBAK_FILENAME}"'
@tw3
Copy link
Author

tw3 commented Jan 27, 2022

Of course you should change the prefix for "GDBAK_FILENAME" as needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment