使用Git时,怎么忽略不想上传的文件

2025-04-23 21:12:16
推荐回答(1个)
回答1:

可以在工程目录下建一个名为  .gitignore  文本文件,将你要忽略的文件类型保存在该文件中。

下面是我C++项目的.gitignore文件内容

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Dir
build-Release/
build-Debug/

#The user local envirment file
*.user