Skip to content

Instantly share code, notes, and snippets.

@tw3
Created January 27, 2022 17:22
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