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!
git mv
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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!