裸仓库中存在的Gitignore文件 [英] Gitignore file that exists in bare repository

查看:82
本文介绍了裸仓库中存在的Gitignore文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图忽略一个VisualGDB设置文件,该文件需要在存储库中可用,以便人们作为基准签出.VisualGDB是一个Visual Studio插件,我希望程序员能够检出基线VS项目,并且只需更改一些小设置就可以非常快速地启动并运行.

I'm trying to ignore a VisualGDB settings file that needs to be available in the repository for people to check out as a baseline. VisualGDB is a visual studio plugin, and I want programmers to be able to checkout a baseline VS project and be able to get up and running very quickly by just changing a few small settings.

问题是,一旦重新签出,我就不希望跟踪更改.每个程序员都将需要此设置文件作为模板,但是他们还需要针对各自的环境进行一些细微调整,因此我不希望这个文件有很多版本.

The issue is I don't want the changes to be tracked once it has been checked out again. Each programmer is going to need this settings file as a template, but they will also need to make minor tweaks for their respective environments and I don't want there to be tons of versions of this file.

我使用基线模板设置创建了存储库,将其推送到裸存储库,将其克隆到新位置,更改了设置并将设置文件添加到gitignore,但是它仍然跟踪更改.有什么想法吗?

I created the repo with the baseline template settings, pushed it to the bare repo, cloned it to a new location, changed settings and added the settings files to gitignore, but it still tracks changes. Any ideas?

推荐答案

将文件添加到git索引后,即使它在.gitignore文件中,git status仍将继续跟踪对该文件的更改

Once a file was added to git index, git status will continue to track changes to that file even if it is in a .gitignore

听起来您想让git忽略对设置模板的更改,但将其保留在存储库中.为此,您可以使用:

It sounds like you would like git to ignore changes to the settings template but keep it in the repo. To do that you can use:

git update-index --assume-unchanged settings.xyz

这会将文件保留在存储库中,但将忽略您所做的任何本地更改.

This will keep the file in the the repository, but will ignore any local changes you make.

为了告诉git重新开始跟踪更改,您可以使用:

In order to tell git to start tracking changes again you can use:

git update-index --no-assume-unchanged settings.xyz

这篇关于裸仓库中存在的Gitignore文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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