简体   繁体   English

将标签值从git repo存储到文件中

[英]store tag value from git repo into file

I am new to git and I have a repo stored on git. 我是git的新手,我在git上存储了一个仓库。 I want to implement version control the tag value that is available on git. 我想实现版本控制git上可用的tag值。

I have a file called version.rb which specifies the version of the plugin that I am currently using, which look like this : 我有一个名为version.rb的文件,它指定我当前正在使用的插件的版本,如下所示:

Version = "0.1.0"

and the tag associated with this commit would be "0.1.0" . 并且与此提交关联的标签将为"0.1.0"

Issue : 问题 :

  Sometimes when I create a new tag for the repo, I would forget to update the value of `Version` in version.rb.

I want to update the Version value in version.rb to be the same value as a the tag value on the repo. 我想将version.rbVersion值更新为与回购中的标记值相同的值。 Is there a way to do this? 有没有办法做到这一点?

Changing a file in a tagged commit does not make the changed file part of the previously tagged commit. 在标记的提交中更改文件不会使更改的文件成为先前标记的提交的一部分。 So if you change version.rb you still have to create another tagged version of your repo. 因此,如果更改version.rb ,则仍然必须创建另一个标记版本的存储库。

Looks like you just have to remember to bump the version in version.rb . 看起来您只需要记住在version.rb中修改version.rb

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

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