为什么 git 忽略我的 /bower_components 文件夹?它将提交 /bower_components/bootstrap,但不会提交任何文件夹内容或 Bower_components 中的任何其他文件夹。
git add --all
git commit -m "adding bootstrap"
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
git clean -ndX
Would remove App_Data/packages/NoGit.0.0.8/node_modules/nogit/node_modules/globa
l-tunnel/node_modules/
dir bower_components
Volume in drive C is BOOTCAMP
Volume Serial Number is 28B2-7D02
Directory of c:\Projects\Blog6\Publish\Latest\bower_components
10/31/2014 10:00 PM <DIR> .
10/31/2014 10:00 PM <DIR> ..
10/31/2014 10:00 PM <DIR> angular
10/31/2014 10:00 PM <DIR> angular-route
10/31/2014 10:46 PM <DIR> bootstrap
... …Run Code Online (Sandbox Code Playgroud) 我正在一个小组中使用 Unity,并且由于我在多个地方读到的内容,我们将以下几行放入我们的.gitignore
# =============== #
# Unity generated #
# =============== #
[Tt]emp/
[Oo]bj/
[Bb]uild
[Ll]ibrary/
sysinfo.txt
*.stackdump
# ============================================= #
# Visual Studio / MonoDevelop / Rider generated #
# ============================================= #
[Ee]xported[Oo]bj/
.vs/
/*.userprefs
/*.csproj
/*.pidb
/*.suo
/*.sln*
/*.user
/*.unityproj
/*.booproj
/.idea*/
# ============ #
# OS generated #
# ============ #
.DS_Store*
._*
.Spotlight-V100
.Trashes
ehthumbs.db
[Tt]humbs.db
[Dd]esktop.ini
Run Code Online (Sandbox Code Playgroud)
当我克隆项目时,工作目录是干净的,但是当我在 Unity 中打开这个项目时,我看到大量文件被标记为已更改git status:

即使这些文件位于 中,为什么还要添加这些文件.gitignore?
我试图从跟踪中删除“js”文件夹中的所有文件。
这是我的 .gitignore:
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
# dependencies
# IDEs and editors
/.idea
# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# js
js/
#System Files
.DS_Store
node_modules/
bower_components/
.sass-cache/
images/
app/test/reportscreenshots/
app/test/report/
Run Code Online (Sandbox Code Playgroud)
请注意,js/它不会从跟踪中删除该文件夹中的文件。这是我的文件夹结构:
为什么我的 .gitignore 不排除“js”文件夹中的文件被跟踪?
所以,我尝试创建一个新项目并使用 BitBucket。我想将我新创建的项目推送到存储库。但是不知何故,我.vs和我的packages文件夹也被提交了。我添加我的.gitignore文件太晚了,它仍然提交了.vs文件。有人可以帮我吗?谢谢
如何从我的存储库中删除这些文件并防止将来发生这种情况?
我有一个 Gemfile.lock,git 根本不会忽略它。它在我的 gitignore 文件中(见下文),但每当我bundle install. 还有其他人遇到过这样的事情吗?提前致谢。
我的 Gitignore 看起来像这样:
/.tags*
/log
/tmp
/db/*.sqlite3
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
Gemfile.lock
...
Run Code Online (Sandbox Code Playgroud) /.idea我想忽略 IDE 中的一个隐藏文件夹。我遵循了https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore的模式,但它并没有被忽略。
// .gitignore
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
package-lock.json
**/node_modules
# testing
/coverage
# production
/build
# Things that I have tried
.idea/
/.idea/
.idea/**
Run Code Online (Sandbox Code Playgroud)
有什么方法可以忽略它?
从我的项目基目录(.gitignore 所在的位置),我想 git 忽略两个文件,
client/public/bundle.js
client/public/bundle.js.LICENSE.txt
Run Code Online (Sandbox Code Playgroud)
我都试过了,**/bundle.js,client/public/bundle.js,但它不工作。我是否需要清除项目中的 git 缓存,以及删除上游/远程存在的文件?
使用 git 版本 2.34.0.windows.1
我的存储库的根目录中有一个/.gitignore文件,其中通常有扩展名被忽略的嫌疑(这里并不真正相关)。
在树的中间 ( /a/b/c/.gitignore),我有另一个文件,我想说“在该目录下递归,忽略任何名为 的目录devl,除了直接在其中的一个特定文件扩展名”。所以我制定了以下规则:
devl/**
!devl/*.dat
Run Code Online (Sandbox Code Playgroud)
不幸的是,这似乎不起作用——git 仍然将文件报告/a/b/c/d/devl/test/foo.bar为未跟踪,而不是忽略。(它根本不会忽略目录树中的任何内容devl。)
我可以通过使用以下规则来解决这个问题,但据我从文档中可以看出,上述内容应该是合法且有效的:
/**/devl/**
!/**/devl/*.dat
Run Code Online (Sandbox Code Playgroud)
为什么是这样?这是错误还是误解?
我创建了一个 C++ 文件并且它运行完美。但当我将代码推送到 GitHub 时,问题就来了。作为构建我的 C++ 程序的结果,有一个可执行文件,并且它被添加到源代码管理中。我不想要这样。
在 Windows 中,可执行文件具有文件扩展名.exe,我可以*.exe在.gitignore. 但在 Ubuntu 中,可执行文件不需要扩展名。我如何让 Git 忽略这一点?
所以我有一个repo,我没有添加任何东西来忽略.png文件,但无论如何都会被忽略.
为什么会发生这种情况,我该如何解决?