I'm using Git for an ASP.net site.
I push changes to the repo.
Then I go to the server, fetch from repo and merge local.
--> Now, I just want to copy the files that have changed over to my 开发者_Go百科Inetpub folder.
Is there an easy way to do this with a Git Bash command?
git show --pretty="format:" --name-only HEAD
Gives you the files that were changed in the latest commit in a one-file-per-line list. HEAD can be replaced by any git treeish, such as a commit sha1 or HEAD^ for the parent of the latest commit, etc.
You directly use this to copy files by piping it to xargs
and copy
using either the -J or -I switch for OS X and linux respectively:
git show --pretty="format:" --name-only bd5b6d356374e2cd64250f68c94e3a1738592a9f | xargs -I % cp % destination_folder
精彩评论