git 向拉取请求添加标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12278660/
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
Adding Tags to a Pull Request
提问by nulltoken
I have a repo iontech/Anagenforked from agiliq/Anagen
我有一个从agilq/ Anagen分叉的 repo iontech/ Anagen
I made a few commits to my fork and added a tag. Then I opened a Pull Request. This Pull Request includes only my commits.
我对我的 fork 做了一些提交并添加了一个标签。然后我打开了一个拉取请求。此拉取请求仅包括我的提交。
How do I include the tag I've created into the Pull Request?
如何将我创建的标签包含在拉取请求中?
回答by nulltoken
How do I include the tag I've created into the Pull Request?
如何将我创建的标签包含在拉取请求中?
You can't. A pull request does not include tags. A pull request is only a pointer to a thread of commits (a branch) in your repository that you're proposing another repository to merge.
你不能。拉取请求不包含标签。拉取请求只是一个指向您的存储库中提交线程(分支)的指针,您提议将另一个存储库合并。
If you want to notify the upstream repository that a tag should be created, maybe should you add a comment to the pull request explaining this.
如果你想通知上游存储库应该创建一个标签,也许你应该在拉取请求中添加一条注释来解释这一点。
回答by Mathieu Dumoulin
This is an old post but i fell on this while searching for something similar, i'll give you a more complete explanation.
这是一个旧帖子,但我在寻找类似的东西时落入了这个,我会给你一个更完整的解释。
Tags and branches in git are called references or "refs". You can move a ref anytime you want to a new commit and thus create loose commits if you move backwards in time. Even worst, those commits could be lost over time if pruned out because they are waiting in the void.
git 中的标签和分支称为引用或“refs”。您可以随时将 ref 移动到新的提交,从而在您及时向后移动时创建松散的提交。更糟糕的是,如果删除这些提交,这些提交可能会随着时间的推移而丢失,因为它们在空虚中等待。
When you submit a PR, you actually ask someone to merge a list of commits in your repository referenced by your branch name (your ref) with a list of commits in a remote repository identified also by a ref (the base branch). If you have commits that are not present in your repository (you aren't up to date) and some of your commits actually touch places of code that you don't have on your side, then a merge needs to be done to resolve conflicts. If you aren't up to date but your code doesn't touch what has been modified since then, there won't be a conflict.
当您提交 PR 时,您实际上是要求某人将您的存储库中由您的分支名称(您的 ref)引用的提交列表与远程存储库中的提交列表合并,该列表也由 ref(基本分支)标识。如果您的存储库中没有提交(您不是最新的)并且您的一些提交实际上触及了您身边没有的代码位置,则需要进行合并以解决冲突. 如果您不是最新的,但您的代码没有触及从那时起修改的内容,则不会发生冲突。
Finally, when stuff is getting merged into another repository, often, it will be squashed to save commit history creating a completely new commit hash and a new tree structure of commits.
最后,当东西被合并到另一个存储库时,通常,它会被压缩以保存提交历史,创建一个全新的提交哈希和一个新的提交树结构。
Taken what i explained so far, that tags are just references just like branches. If you open a PR between two repositories' references that are branch references, then there is no way to create a tag because you are not creating any new refs in the end, you are just asking someone to take your commits into his code and move the base branches reference forward to the new commit after everything is merged in!
就我到目前为止所解释的而言,标签只是像分支一样的引用。如果您在作为分支引用的两个存储库引用之间打开 PR,则无法创建标签,因为您最终没有创建任何新引用,您只是要求某人将您的提交放入他的代码中并移动合并所有内容后,基本分支会引用新的提交!
The best and only method really becomes to ask the maintainer to issue a release for his code by tagging if that's the way they do it but that is to their discretion!
最好也是唯一的方法真的变成了要求维护者通过标记他们的方式来发布他的代码的版本,但这是他们的判断力!