If there is tag 1.1 for master branch in github, I want to create a pull request with some commits that only apply to that very tag. Is this possible?


A tag is a named reference to a commit that cannot be moved (without deleting and re-tagging). A branch is a reference to a commit that can be moved forward to track development. So while you can make a local branch off a tagged commit, you can't push a commit to a tag--you have to make a PR to merge into another branch.

You could create a branch in your remote named something like 1.1-backfix off the 1.1 tag, and create a PR to merge into 1.1-backfix. You could delete and re-tag the new commit as 1.1 (although I wouldn't recommend it). You should probably tag the merge commit as 1.1.1 or some distinct version number when it's released so it can be distinguished from 1.1

  • 1
    Both tags and branches are just labels attached to a commit. The difference is that tags are used to refer to a specific version and are expected to never change, whereas branches are floating labels that always point to the most recent commit of a development effort. The only way to move a tag is to delete and then re-create it, and should only be done if a tag was created mistakenly. It is quite sensible that GitHub only allows PRs on branches. – amon Jul 20 '17 at 20:53
  • By the way, I really enjoy your answers here on Software Engineering :) – amon Jul 20 '17 at 20:56
  • Cheers mate! I've updated my answer using some of your better explanation. – Samuel Jul 20 '17 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.