如何在 git gui 中使用标签进行版本控制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6158598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use tags for versioning in git gui
提问by Edwood
I'm a complete and utter noob, so be gentle!
我是一个彻头彻尾的菜鸟,所以要温柔!
I'm using git gui, and never touching the command line interface. I'm a noob, and some of the people i'm working with are even noob-ey-er...
我正在使用 git gui,从不接触命令行界面。我是个菜鸟,和我一起工作的一些人甚至是菜鸟......
Current state:
- I have a repository on git hub which contains a handful of scripts (henceforth 'code')
- I'm using git gui (mysysgit)
- I have made commits and push's and have a vague understanding of CVS
- I don't believe we will need to branch
当前状态: - 我在 git hub 上有一个存储库,其中包含一些脚本(以下称为“代码”)
- 我正在使用 git gui (mysysgit)
- 我已经提交和推送并且对 CVS 有一个模糊的理解
- 我不知道不相信我们需要分支
I feel that I should be able to use tags to create versions of the code. I also 'feel' like there should be an equivelant structure in the filesystem where the snapshots (or links to...) are stored.
我觉得我应该能够使用标签来创建代码的版本。我也“感觉”在文件系统中应该有一个等效的结构,其中存储了快照(或指向...的链接)。
eg:
.\EdsLittleThing\v1.0
.\EdsLittleThing\v1.1
.\EdsLittleThing\v1.2
etc
例如:
.\EdsLittleThing\v1.0
.\EdsLittleThing\v1.1
.\EdsLittleThing\v1.2
等
However, I can not work out how to create a tag within git gui. The only tag reference i can find seems to be tied to merging branches, and that doesn't help me.
但是,我无法弄清楚如何在 git gui 中创建标签。我能找到的唯一标记参考似乎与合并分支有关,这对我没有帮助。
I have scoured the web, and can not find a single reference on how to create and manage versions using Git Gui.
我在网上搜索,找不到关于如何使用 Git Gui 创建和管理版本的单一参考。
I want to be able to create a slightly more simple version of this:
我希望能够创建一个稍微简单的版本:
Final note: Whilst I'm led to believe that my answer is found in 'tags', I dont really care if its really answered by using revisions / branches / whatever.
最后一点:虽然我相信我的答案是在“标签”中找到的,但我真的不在乎它是否真的通过使用修订/分支/其他方式得到了回答。
回答by Seth Robertson
You want to use gitk, available by Repository->Visualize…
你想使用 gitk,可以通过 Repository->Visualize...
In the top pane, right click on the commit you want to tag at, and select create tag.
在顶部窗格中,右键单击要标记的提交,然后选择创建标记。
In the git model, you do not typically have tags checked out to disk under the same repository. You could have multiple repositories (all cloned from upstream) or the not suggested multiple working directories at different revisions with one revision, but most times simply using git's tool obviates the need to have multiple versions checked out at the same time.
在 git 模型中,您通常不会将标签检出到同一存储库下的磁盘。您可以拥有多个存储库(全部从上游克隆)或不建议使用一个修订版在不同修订版中使用多个工作目录,但大多数情况下,只需使用 git 工具即可避免同时检出多个版本的需要。
What you are suggesting is nothinglike the gitflow model, so I don't recommend using that as a reference. Read the ProGit book, http://progit.orgfor good advice and a few other workflows. I use one which is none of the above.
什么你的建议是什么样的gitflow模型,所以我不建议使用作为参考。阅读 ProGit 书籍,http://progit.org以获得好的建议和其他一些工作流程。我使用的不是上述任何一种。
Typically you tag at major milestones. I tag when a piece of code becomes customer visible, or when we have code ready to move into formal QA practices. There is typically no need to tag as reminders of when things happened. That is what commit messages are for.
通常,您会在主要里程碑处进行标记。当一段代码成为客户可见的时候,或者当我们准备好进入正式的 QA 实践的代码时,我会标记。通常不需要标记为事件发生时间的提醒。这就是提交消息的用途。
回答by Edwood
Thanks for the help fellas.
感谢小伙伴们的帮助。
I managed to add tags using the method described above
我设法使用上述方法添加标签
You want to use gitk, available by Repository->Visualize…
In the top pane, right click on the commit you want to tag at, and select create tag.
你想使用 gitk,可以通过 Repository->Visualize...
在顶部窗格中,右键单击要标记的提交,然后选择创建标记。
I then had the problem that my tags were not being included in the push. Therefore, any tags I added were only stored locally, and useless for collaboration.
然后我遇到了我的标签没有包含在推送中的问题。因此,我添加的任何标签都仅存储在本地,对协作无用。
The last step in the process is to take one more step when you push...
该过程的最后一步是在您推动时再迈出一步...
When you click push, a window pops up, the bottom check box says "include tags in push". Tick this box, and you should be away laughing!
单击推送时,会弹出一个窗口,底部的复选框显示“推送中包含标签”。勾选这个框,你应该笑了!
回答by Ivan
I started gitkfrom Git Gui, highlighted a commit (initial commit in the example below) by left clicking on it, and then right clicked on the selected commit to produce the pop-down menu shown, where the Create tagoption is shown, highlighted.
我从Git Gui开始gitk,通过左键单击突出显示一个提交(下面示例中的初始提交),然后右键单击所选提交以生成显示的弹出菜单,其中显示了创建标签选项,突出显示.
A pop-up then appeared as shown further below.
然后出现一个弹出窗口,如下所示。
回答by petrnohejl
If you want to add tag with Tortoise GIT:
如果你想用 Tortoise GIT 添加标签:
- show log
- right click on commit and create tag at this version
- push with checked include tags
- 显示日志
- 右键单击提交并在此版本中创建标签
- 使用选中的包含标签推送
If you want to remove tag via Tortoise GIT:
如果你想通过 Tortoise GIT 删除标签:
- show log
- right click on commit and delete refs/tags/x.y.z
- push with empty local branchfield and enter your tag name into the remote branchfield
- 显示日志
- 右键单击提交并删除 refs/tags/xyz
- 使用空的本地分支字段推送并在远程分支字段中输入您的标签名称
回答by birwin
I was more interested in deleting a tag through the interface. I could not find how to do that using Git GUI, so I had to run this command on the command-line.
我对通过界面删除标签更感兴趣。我找不到如何使用 Git GUI 来做到这一点,所以我不得不在命令行上运行这个命令。
git tag -d [nameoftag]