使用git将.gitignore文件生效

.gitignore 设置后不见效的解决方法中,方案一就可以了 阅读详情

一、.gitignore文件内容

##ignore this file##
/target/
.classpath
.project
.settings
##filter databfile、sln file##
*.idea
*.iml
*.mdb
*.ldb
*.sln
##class file##
*.com
*.class
*.dll
*.exe
*.o
*.so
# compression file
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.via
*.tmp
*.err
# OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

二、步骤

当我们在做项目的时候,有时候会不小心将一些.idea、.project、.class文件提交到远程仓库去,这样会造成很多冲突和不必要的麻烦。但是在此之后我们才将.gitignore提交上去,此时.gitignore文件还没生效,以下是生效的步骤

1.git rm -r --cached . #清除缓存,将那些隐藏文件进行清除掉,避免再次上传
2.git add . #重新trace file
3.git commit -m "update .gitignore" #重新提交
4.git push origin master #可选,如果需要同步到remote上的话,后面跟的分支名视具体情况而定

这样就能够使修改后的.gitignore生效。

在这过程中可能还会让你重新填写用户名和密码,填了就是。

记录 | 修改.gitignore文件,如何重新生效 阅读详情

相关推荐

VS code平台调试AutoLISP程序教程

VS code平台调试AutoLISP程序教程

BearElder的博客 3189

git更新.gitignore并使其生效

这次我们需要清除一下缓存cache,才能是.gitignore 生效。在使用git过称中,需要对.gitignore文件进行再次的修改。

胡西风的博客 1万+

单细胞转录组上游分析完整流程(超详细)

本指南详细介绍单细胞转录组数据分析流程,从10xGenomics平台数据出发,使用CellRanger工具完成从原始FASTQ文件到基因表达矩阵的全过程。内容涵盖:1) 环境准备与参考基因组获取;2) 测试数据下载;3) 数据质量检测方法;4) CellRanger核心流程详解;5) 结果解读;6) 下游分析衔接。同时提供开源替代方案kallisto|bustools的使用说明,并解答常见问题。适合单细胞转录组分析初学者快速掌握标准分析流程。

Rita_rr的博客 1161

git:修改.gitignore后生效

在使用git的时候我们有时候需要忽略一些文件或者文件夹。我们一般在仓库的根目录创建.gitignore文件 在提交之前,修改.gitignore文件,添加需要忽略的文件。然后再做add commit push 等 但是有时在使用过称中,需要对.gitignore文件进行再次的修改。这次我们需要清除一下缓存cache,才能是.gitignore 生效。 具体做法: git rm -r --cached . #清除缓存 git add . #重新trace file git commit -m..

flyingnet的博客 8243

Docker一键部署Synopsys EDA全家桶(VCS/Verdi 2018版)保姆级教程

本文提供了一份详尽的Docker容器化部署Synopsys EDA工具链(VCS/Verdi 2018版)的保姆级教程。通过环境隔离与标准化,解决传统安装的依赖冲突问题,并重点攻克了容器内GUI图形界面显示的核心难题。教程涵盖从Docker基础安装、镜像获取、容器启动配置,到使用X11转发或VNC实现Verdi完美显示的完整实践,旨在帮助芯片设计工程师快速构建稳定、可移植的一键化EDA工作环境。

weixin_29281941的博客 199

基于单片机控制双向可控硅灯光强度设计

*单片机设计介绍,基于单片机控制双向可控硅灯光强度设计。

QQ2193276455的博客 2458

git如何使 .gitignore 配置的文件生效

欢迎关注公众号,与Joker一起探索测试之道。

Anthony路人甲的博客 4859

CANape快速上手

文章帮助记录CANape学习过程。

小弱鸡的博客 1万+

Git 系列,Git 忽略文件 .gitignore 不生效怎么办?不要误人子弟了!!!

Git 忽略文件 .gitignore 不生效

愿你饱经冷暖,仍保纯真 3064

Python爬虫:抓取外卖平台餐厅菜单、价格与评价数据

美团外卖:国内领先的外卖平台之一,提供餐饮外卖、超市配送等服务。饿了么:另一大主流外卖平台,覆盖广泛的餐饮品类。等:国际性的外卖平台。在本文中,我们将以美团外卖为例,展示如何抓取餐厅的菜单、价格和评价等数据。我们会使用Python的爬虫库,如Scrapy和Selenium,来解决抓取任务。本文详细介绍了如何使用Python爬虫抓取外卖平台上的餐厅菜单、价格、评价等信息。我们展示了如何使用Scrapy和Selenium抓取静态与动态网页数据,如何清洗和存储数据,并讨论了如何应对外卖平台的反爬虫机制。

2201_76125261的博客 1500

vue项目表格甘特图开发

🧩 甘特图可以管理项目进度,生产进度等信息,管理者可以更直观的查看内容。

qq_35946021的博客 991

Git .gitignore 文件不生效的原因及解决方法

Git忽略文件失效问题解决方案 摘要:当.gitignore文件失效时,通常是因为文件已被Git跟踪、.gitignore位置错误、语法错误或缓存未清除。解决方案包括:1)使用git rm --cached移除已跟踪文件;2)确保.gitignore位于项目根目录;3)检查忽略规则语法;4)清除Git缓存。建议项目初期就设置好.gitignore,并定期检查更新。不同项目类型(如Node.js/Python/Java)需要配置特定的忽略规则,可使用GitHub提供的模板简化配置。

qq_71214810的博客 1725

【深度学习基础】多任务学习(Multi-Task Learning)

多任务学习(Multi-task learning)是和单任务学习(single-task learning)相对的一种机器学习方法。在机器学习领域,标准的算法理论是一次学习一个任务,也就是系统的输出为实数的情况。复杂的学习问题先被分解成理论上独立的子问题,然后分别对每个子问题进行学习,最后通过对子问题学习结果的组合建立复杂问题的数学模型。多任务学习是一种联合学习,多个任务并行学习,结果相互影响。一次只学习一个任务(task),大部分的机器学习任务都属于单任务学习。

十二月的猫 1万+

Git编辑.gitignore文件并使其生效

当我们开发完一个项目想将项目推送到远程仓库时,我们大多数时候都是将所有的文件添加到仓库中并且推送到远程仓库。这样的方式在项目不大的时候是不会引起大问题的,但是远程仓库是有限的,如果我们的项目越来越大会导致远程仓库的存储不够。在git中,我们可以通过一个名叫.gitignore的配置文件配置我们不需要添加到版本库的文件,然后添加的文件就可以不被提交到远程仓库了。

知识应该共享,创造才应收费 3572

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

GIT使用,修改 .gitignore 文件,如何重新生效

GIT使用,修改 .gitignore 文件,如何重新生效 1 git rm -r --cached . # 清除缓存 2 git add . # 追踪文件 3 git commit -m "更新.gitignore" # 注释提交 4 git push origin master # 推送远程

ziyanlian9494的博客 4156

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

Git某些情况下配置 .gitignore 忽略文件后不生效

项目中有个配置文件,由于跟同事的开发环境不一样,配置文件内容也不一样,每次提交都要注意不能把配置文件交上去,遂准备配置.gitignore,忽略掉文件。但是,配置后发现,提交时该配置文件依旧在commit列表,查了一通找到了原因。

qq_45576664的博客 829

git——.gitignore添加忽略文件不生效

使用git rm: 如果您已添加要跟踪的文件,则需要将其从跟踪中删除: git rm env.local --cached git rm env.staging --cached git commit -m “Stopped tracking env.local, and env.staging” 现在,您应该能够克隆您的分支,而不会跟踪这些文件. 注意:请记住,这些文件的内容在您的历史记录中,如果它 ...

L3gacy 6090

git 中.gitignore文件不生效

.gitignore文件 新增忽略文件并没有生效 新增的忽略文件没有生效,是因为git是有缓存的,而之前的文件在缓存中,并不会清除掉,还会继续提交,所以更新.gitignore文件,要清除缓存文件 git rm -r --cached . git add . git commit -m 'update .gitignore' ...

lee小白菜的博客 2241

解决Git添加.gitignore文件后不生效的问题

解决Git添加.gitignore文件后不生效的问题

xiaoqian7758258的博客 1850

【已解决】Git:为什么 .gitignore 不生效?如何停止跟踪已提交文件并阻止推送?

通过此方法,你可以灵活管理本地文件与远程仓库的关系,避免误操作导致敏感数据或大文件泄漏到仓库中。

TIM的博客 1374

git .gitignore文件生效

文章目录问题原因解决 问题 有个项目中发现.gitignore文件也存在,但就是不生效,由于历史、人员离职等原因该项目无人管理,偶现一个bug,排查验证后就上线了,但提交时编译类的问题看得眼花缭乱,/target下的编译文件、.iml的配置 文件,看得不够清爽,决定捣腾下。 原因 .gitignore文件中只会忽略从始至终未被Git跟踪的文件。怎么理解?打个比方项目刚开始初始化时.gitignore没有创建,后续提交时也没有将如/target下的文件过滤掉从而导致编译文件被提交至Git,那么即使后来新建了.

吴码 398

git 忽略文件不生效.gitignore

git 忽略文件不生效

anyhowanywhere的博客 211

Git忽略规则原理和.gitignore文件不生效的原因和解决办法

然而,在实际使用过程中,有时我们会发现.gitignore文件中的规则并未生效,导致一些不希望被追踪的文件仍然出现在Git仓库中。当执行git add、git status等命令时,Git会检查.gitignore文件,并根据其中的规则决定是否忽略某些文件或目录。如果某个文件在.gitignore文件被添加之前已经被Git追踪(即已经通过git add命令加入到暂存区或已经被提交到仓库中),那么即使该文件符合.gitignore中的忽略规则,Git仍会继续追踪它。2、文件位置不正确.gitignore。

u013050118的专栏 1240

git忽略规则以及.gitignore文件不生效解决办法

前言 在git中如果想忽略掉某个文件,不让这个文件提交到版本库中,可以使用修改根目录中 .gitignore 文件的方法(如果没有这个文件,则需自己手工建立此文件) 正文 Git忽略规则: #此为注释 – 内容被 Git 忽略 .sample    # 忽略所有 .sample 结尾的文件 !lib.sample    # 但 lib.sample 除外 /TODO    # 仅仅忽略...

akoooo的专栏 1175

git将文件或目录添加进了.gitignore文件,为什么不生效?

已经添加到git仓库中的文件,如果在.gitignore中加入忽略,是不会生效的,因为他们已经添加到git仓库中了。 要先git rm --cached在git仓库中删除这些文件,然后再用git commit 提交这个删除操作。然后,.gitignore中对这些文件的忽略才会生效。 注意:git rm --cached只是让git不再托管这些文件,一定要加上--cached选项,如果不加,git不仅删除此文件的托管关系,还会从硬盘上删除此文件,可怕~~ 例: mokar@ubuntu:~/temp/555$

panfei263031的博客 8692
上一篇: inner join,left join,right join
下一篇: 通过Navicat解决 "1045 - Access denied for user 'root' @'localhost' (using password: YES)"
Ai_Ying_Java
博客等级 码龄9年 30粉丝 47原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值