如何提取 git 中某个文件的所有版本并按顺序命名好
伊谢尔伦
伊谢尔伦 2017-04-24 09:11:56
0
3
599

如题,我想将 git 里某个文件的所有版本文件全部都复制一份打包,但是不知道从何入手,有什么好的办法呢?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
小葫芦

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.{}'
Peter_Zhu
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.

阿神

Refer to @Evian’s answer

git log --follow --pretty=format:%H README.md|awk '{print "git show "":README.md > README.md."NR"."}'|sh
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template