我有一个案例,我修改的文件没有显示为修改后的文件。
我还能提交那个文件吗?
我可以将列为未更改文件的文件添加到已更改文件吗?谢谢!
更新: 当我尝试添加文件时,终端出现这样的错误:
The following paths are ignored by one of your .gitignore files:
folderpath/filename.java
Use -f if you really want to add them.
fatal: no files added
但是当我打开我的 .gitignore 文件时:
bin
gen
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated GUI files
*R.java
# Mac OS file
.DS_Store
和信息/排除
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
我非常确定我的文件夹路径及其文件名未包含在 .gitignore 和排除文件中
最佳答案
git 不会跟踪未跟踪文件中的更改。
所以首先要确保你的文件确实被 git 跟踪了。其他人详细说明了为什么您的文件可能会被忽略(.gitignore
、.git/info/exclude
、...)
然后确保您的文件确实包含更改(似乎很明显)。 你对文件做了什么样的改变? 请注意,您可以将 git 配置为忽略对 EOL 的更改,因此通过将 CRLF 更改为 LF 来修改文件不符合“要提交的更改”的条件。检查this .
关于git - 如何提交和/或添加未更改的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11790671/