简体   繁体   English

Github标记时取消忽略文件

[英]Github un-ignore a file when tagging

I have a git repository where the compiled version of my project is ignored in .gitignore . 我有一个git仓库,在.gitignore忽略了项目的编译版本。

When I release a new version of my project (tag the master branch to the version) I want to commit the compiled files, but then revert back to ignoring them. 当我发布项目的新版本时(将master分支标记为该版本),我想提交已编译的文件,但是又恢复为忽略它们。

is this possible? 这可能吗? I would like to avoid committing a new version of my .gitignore every time I release a new version. 我想避免每次发布新版本时都提交.gitignore的新版本。

You can do git commit -f file-in-gitignore (probably also git add -f file-in-gitignore ). 您可以执行git commit -f file-in-gitignore (也可以git add -f file-in-gitignore )。 In general, it is a bad idea to include generated files, perhaps open a branch just for those files, or distribute them somewhere else? 通常,包括生成的文件,或者为这些文件打开一个分支,还是将它们分发到其他地方,是一个坏主意?

When I release a new version of my project (tag the master branch to the version) I want to commit the compiled files 当我发布项目的新版本时(将master分支标记为该版本),我想提交已编译的文件

Why not. 为什么不。
I would simply recommend not doing it in the same referential. 我只是建议不要在相同的参照中这样做。

A source version control system will retain the history of what you are putting inside, and binaries don't diff well, consuming space quickly. 源代码版本控制系统将保留您所放内容的历史记录 ,而二进制文件不会很好地进行区分,从而很快占用空间。

An artifact repository ( like Nexus , or other alternatives ) is much more suited for that kind of release (for binaries or any kind of generated files), the idea being that you can very easily purge old releases from the referential (a simple flat files-based system). 工件存储库例如Nexus其他替代产品 )更适合这种发布(适用于二进制文件或任何类型的生成文件),其思想是您可以轻松地从参照中清除旧发布(一个简单的平面文件)的系统)。

Don't forget to include in your release a file text declaring the SHA1 or your source repo, in order to keep a link between the exact revision of your sources from which you produced said binaries. 不要忘记在您的发行版中包含一个声明 SHA1或源代码仓库的文本,以便在产生所述二进制文件的源代码的确切修订版之间保持链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM