开发者

git noob: how to copy just the updated files to a target directory?

开发者 https://www.devze.com 2023-03-18 22:15 出处:网络
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.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号