Last active
March 27, 2018 00:31
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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