gitignore没有扩展名的二进制文件 [英] gitignore binary files that have no extension

查看:110
本文介绍了gitignore没有扩展名的二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用.gitignore文件在git中忽略二进制文件?

How can binary files be ignored in git using the .gitignore file?

示例:

$ g++ hello.c -o hello

"hello"文件是二进制文件. git可以忽略此文件吗?

The "hello" file is a binary file. Can git ignore this file ?

推荐答案

# Ignore all
*

# Unignore all with extensions
!*.*

# Unignore all dirs
!*/

### Above combination will ignore all files without extension ###

# Ignore files with extension `.class` & `.sm`
*.class
*.sm

# Ignore `bin` dir
bin/
# or
*/bin/*

# Unignore all `.jar` in `bin` dir
!*/bin/*.jar

# Ignore all `library.jar` in `bin` dir
*/bin/library.jar

# Ignore a file with extension
relative/path/to/dir/filename.extension

# Ignore a file without extension
relative/path/to/dir/anotherfile

这篇关于gitignore没有扩展名的二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆