适用于Windows的Github忽略.gitignore文件 [英] Github for Windows ignoring .gitignore file

查看:520
本文介绍了适用于Windows的Github忽略.gitignore文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让.gitignore忽略NetBeans项目中除我的src文件之外的所有内容.我的gitignore看起来像这样

I'm trying to get my .gitignore to ignore everything except my src files in my NetBeans project. My gitignore looks like this

nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

及其直接放置在netbeans项目的根目录中.每当我在NetBeans中构建/运行时,总是说Netbeans Project/build/built-jar.properties和Netbeans Project/dist/CodeEditor.jar中存在未提交的更改,这两个都应忽略. (如果我修改源代码,则与其他.class文件一起使用).如何让Windows版Github忽略这些文件?

and its placed directly in the root directory of the netbeans project. Whenever i build/run in NetBeans, it always says theres uncommitted changes in Netbeans Project/build/built-jar.properties and Netbeans Project/dist/CodeEditor.jar, both of which should be ignored. (along with other .class files if i modify the source code). How do i get Github for Windows to ignore these files?

git repo位于此处 https://github.com/Arhowk/fJass

the git repo is located here https://github.com/Arhowk/fJass

推荐答案

似乎您可能在将文件添加到.gitignore文件之前的某个时候将该文件添加到了索引中.

It looks like you probably added that file to the index at some point prior to adding it to the .gitignore file.

进入git不会跟踪文件删除的位置这很容易(因为它已经在.gitignore!中)-因此,实现所需功能的最简单方法是:

It's fairly easy to get yourself into this tight spot where git won't track the delete of the file (because it's already in the .gitignore!) - so the easiest way to achieve what you need is to:

  • .gitignore文件中删除特定文件
  • 删除文件
  • 执行此删除操作
  • 将行重新添加到.gitignore
  • 重新添加您忽略的文件.
  • Remove the specific file from the .gitignore file
  • Delete the file
  • Commit this deletion action
  • Add the line back into the .gitignore
  • Re-add your ignored file.

OR

git rm --cached filename并使用git commit -m "msg"提交更改,您将完成.

git rm --cached filename and commit the change using git commit -m "msg" and you will be done.

这篇关于适用于Windows的Github忽略.gitignore文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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