6

git导出排除指定文件的方法

 2 years ago
source link: https://www.lujun9972.win/blog/2019/03/22/git%E5%AF%BC%E5%87%BA%E6%8E%92%E9%99%A4%E6%8C%87%E5%AE%9A%E6%96%87%E4%BB%B6%E7%9A%84%E6%96%B9%E6%B3%95/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

git导出排除指定文件的方法

Git可以将指定分支导出成Zip或Tar格式的打包文件,而这些打包文件中默认包含了分支中的所有内容。 但是其实分支中很多文件打包下来可能是没有意义的,被那些dotfiles(.gitignore,.travis.yml)之类。

要排除这些文件我们只需要使用 .gitattributes 文件中的 export-ignore 属性就行了,比如

.* export-ignore
/examples export-ignore

除了 export-ignore 之外, .gitattributes 还支持其他很多属性,比如:

text控制行尾的规范性 eol设置换行符 merge如何合并文件 delta是否Delta压缩

详细信息可以参见 man gitattributes


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK