如题,我想将 git 里某个文件的所有版本文件全部都复制一份打包,但是不知道从何入手,有什么好的办法呢?
高洛峰2017-04-24 09:13:56
I don’t know what you want to name it. Let me make the simplest version, with additional submission value:
git log --follow --pretty=format:%H vimrc | xargs -I{} sh -c 'git show {}:vimrc > vimrc.{}'
天蓬老师2017-04-24 09:13:56
git log --follow file
You can get the commits of all historical versions of this file.
Based on this information, you can write a script to extract the file contents of each version and then package them.
阿神2017-04-24 09:13:56
Refer to @Evian’s answer
git log --follow --pretty=format:%H README.md|awk '{print "git show "":README.md > README.md."NR"."}'|sh