Is it possible to download ONLY files changed in a commit/revision using git archive

℡╲_俬逩灬. 提交于 2019-12-06 08:20:41

问题


Using git archive commmand is it possible to download only the changed/affected files from a repository for a particular commit id ? Is it possible using the web interface @ bitbucket ?


回答1:


List the files changed in a commit with git diff-tree and pass them to the command line of git archive.

git archive --format=zip --output=commit_files.zip <tree-ish> `git diff-tree --no-commit-id --name-only -r <tree-ish> | sed ':a;N;$!ba;s/\n/ /g'`



回答2:


You can create an archive file focused on a specific commit, but it archives the entire repo, not just the changed/affected files. You could probably figure those out by the log though.

Example: if you wanted the latest changes from bitbucket it would look something like:

git archive -format=tar --remote=<PATH_TO_YOUR_REPO> HEAD


来源:https://stackoverflow.com/questions/12073559/is-it-possible-to-download-only-files-changed-in-a-commit-revision-using-git-arc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!