简体   繁体   English

git pull在文件上带有新的最新标签信息

[英]git pull with new latest tag info on the file

been trying to find out if there is a way to pre-write the tag version inside a file, so each time when i pull the code from repo, it should write the latest tag version number automatically. 一直试图找出是否有一种方法可以在文件中预写标签版本,因此,每次我从回购中提取代码时,它都应该自动写最新的标签版本号。 so i would know, which guy is using that file from which version.. 所以我会知道,哪个人正在使用哪个版本的文件。

is there a way to put tag information on a file , so when i retrive the file it pre-write the current tag id on it? 有没有办法将标签信息放在文件上 ,所以当我检索文件时,它会在文件上预写当前标签ID

i have search many places, but cant find proper answer.. some way using git describe and some say use hook.. 我已经搜索了很多地方,但是找不到正确的答案..以某种方式使用git describe和某些人说使用钩子..

你的意思是这样吗?

git describe --tags > version.txt

您可以检查man gitattributes ,特别是filter部分。

I guess you are misunderstanding some concept on tag. 我想您误解了标签上的某些概念。

You can say, a tag is an alias of a particular SHAsum of a commit. 可以说,标记是提交的特定SHAsum的别名。

You can also checkout the file to a particular point through its SHAsum 您也可以通过其SHAsum将文件检出到特定点

git checkout <Shamsum of a point> -- <path to file>

or by tagname 或按标记名

git checkout <tagname> -- <path to file>

you can always keep track which one did the correction, or made commit on that particular file. 您始终可以跟踪进行了更正的人或对该特定文件进行过提交的人。

git blame -- <path to file> (the latest version) git blame -- <path to file> (最新版本)

or 要么

git log -- <path to file> to see all the commits on that particular file git log -- <path to file>查看该特定文件上的所有提交

Hope this help 希望这个帮助

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

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