Created
May 2, 2018 01:47
-
-
Save gajoseph/c46d093f0d88e6560f0796aa1798f02d to your computer and use it in GitHub Desktop.
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
/* | |
to copy/ archive changed files on git commit to local repository this might help | |
in my case need was to copy to /r/edt/Data\ and\ Analytics/deploy/ | |
git hooks are located under .git\hooks under local respository | |
tosetup:: | |
$git lfs update | |
$ git lfs update --force | |
then update .git/hooks/post-comit | |
*/ | |
#!/bin/sh | |
git diff --name-only HEAD^ > /c/tmp/updated.txt ## gives chnaged files | |
filename="/c/tmp/updated.txt" | |
pathtoCp=/r/edt/Data\ and\ Analytics/deploy/ | |
while read -r line | |
do | |
#echo $line | |
name=$(echo $line | awk -F"/" '{print $1}') | |
#echo $name; | |
if [ "$name" == "PHASE1" ] | |
then | |
echo " Copying $line to $pathtoCp""Phase\ 1" | |
echo $line| xargs -i cp {} "$pathtoCp"Phase\ 1 | |
else | |
if [ "$name" == "PHASE2" ] | |
then | |
echo " Copying $line to $pathtoCp""Phase\ 2" | |
echo $line | xargs -i cp {} "$pathtoCp"Phase\ 2 | |
else | |
if [ "$name" == "PHASE3" ] | |
then | |
echo " Copying $line to $pathtoCp""Phase\ 3" | |
echo $line | xargs -i cp {} "$pathtoCp"Phase\ 3 | |
fi | |
fi | |
fi | |
done < "$filename" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice