Adding Tags to a Pull Request

柔情痞子 提交于 2019-12-20 10:21:29

问题


I have a repo iontech/Anagen forked from agiliq/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.

How do I include the tag I've created into the Pull Request?


回答1:


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.




回答2:


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.

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.

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!

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!



来源:https://stackoverflow.com/questions/12278660/adding-tags-to-a-pull-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!