Hmmm...this should work for renamed files. There may be an error for the original file that no longer exists, but that should not stop the command from working. What are you observing?
True, when you rename the file, eventually file does not exist hence the renamed file is not considered.
I added a small if-else(just for renamed files) in the above statement to make it work for my use case.
Hmmm...this should work for renamed files. There may be an error for the original file that no longer exists, but that should not stop the command from working. What are you observing?
True, when you rename the file, eventually file does not exist hence the renamed file is not considered.
I added a small if-else(just for renamed files) in the above statement to make it work for my use case.
git status --porcelain=v1 | awk {' if ($1 == "R") print $4 ; else print $2'} | xargs -I {} cp -r {} modified_files/
Ah I see. You are actually doing a
git mv
to rename your files. Yes, you are right, in that case your solution is perfect! Thanks for sharing!