如何在 GIT 中标记单个文件 [英] How to Tag a single file in GIT
问题描述
我对 git 很陌生.我目前正试图通过使用它来跟踪我正在维护的一些 excel 文件中的更改来熟悉它,以跟踪我参与的一些连续活动.所有文件都在一个存储库中.我想用它们的版本分别标记每个文件.这可能吗?到目前为止,我发现能够标记整个存储库.如果我尝试做的事情是错误的,请告诉我最佳做法.
I am very new to git. I am currently trying to get familiarized with it by using it to track changes in some excel files that I am maintaining to track some continuous activity I am involved with. All the files are in a single repository. I want to tag each file separately with their versions. Is this possible? So far what I found was the capability to tag the entire repository. If what I am trying to do is wrong, do advise me on the best practice.
提前致谢.
编辑
当我这样做时,我故意删除了以前的标签,以便将整个存储库标记为 v1.0(因为我没有找到标记单个文件的方法).由于我现在想用文件名重置标签的名称并且对事情应该发生的方式非常满意,我如何回滚删除并重命名前一个标签(已删除的标签)?
When I was doing this I deliberately deleted a previous tag to make the entire repository be tagged( as I did not find a way to tag single files) as v1.0. As I now want to reset the name of the tag with the file name and quite comfortable with the way things should happen, how can I rollback the deletion and rename the previous tag (the deleted tag)?
推荐答案
标签放置在特定提交上,而不是您在问题中建议的整个存储库.
Tags are placed on specific commits as opposed to the repository as a whole as you suggest in your question.
执行您建议的一种方法是确保每次提交时只提交对单个文件的更改,然后您可以使用例如标记该提交.file1-v1.0
代表file1的v1.0.
One way of doing what you are suggesting is making sure you only commit changes to a single file with each commit, then you can tag that commit with eg. file1-v1.0
to represent v1.0 of file1.
你想通过标记这些提交来代表什么?这将影响有关如何改进流程的任何建议.
What are you trying to represent by tagging these commits though? That will influence any advice on how to better your process.
这篇关于如何在 GIT 中标记单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!