Skip to content

Instantly share code, notes, and snippets.

@matheusfaustino
Last active March 27, 2018 00:31
Show Gist options
  • Save matheusfaustino/a9c13a17d95ba84a98d94a93d95e624f to your computer and use it in GitHub Desktop.
Save matheusfaustino/a9c13a17d95ba84a98d94a93d95e624f to your computer and use it in GitHub Desktop.
Copy all files modified (keeping folder tree) in a git repository to a target folder
#
# In a git repo folder
# Usage: copy_modifications ~/folder/target
#
copy_modifications () {
git status -sb | grep -e '^ M' | cut -c 2- | awk '{printf("rsync -Rv %s '$1'/\n",$0);}' | sh;
}
copy_additions () {
git status -sb | grep -e '^A' | cut -c 2- | awk '{printf("rsync -Rv %s '$1'/\n",$0);}' | sh;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment