1

We're following a GitHub flow strategy (creating feature/bugfix branches off master, and merging them back in via pull request once done). We also tag versions as each new release of the software is shipped.

We've found a bug in an old version (say tag v1.0.0) and fixed it in a 'bugfix-branch' off of that tag, as below:

         |tag: v1.0.0              |where we are now
         |                         |
master --| * ----------------------| head
          \----- bugfix-branch

I want to merge bugfix-branch into the current head of master (which contains things we don't want to ship yet), but also want to create a v1.0.1 tag based on the old tagged version (logically just after v1.0.0, where the * is shown below) that we can ship.

To hopefully make clearer, bug-fix branch contains 3 commits. Can I:

  1. merge bug-fix branch into master (preferably as squash commit)
  2. tag the head of bug-fix branch as v1.0.1
  3. delete bugfix-branch (but keep tag v1.0.1 in tact)?

to give:

         |tag: v1.0.0             |where we were
         | |tag: v1.0.1           |   |where we are now (inc. bugfix-branch commit)
master --| | ---------------------|---| head
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Jonny
  • 3,807
  • 8
  • 31
  • 48

1 Answers1

0

A tag is just an alternative name for one commit. It does not “contain” anything. Choose a commit and tag it! It sounds to me like you want to tag the commit currently called bugfix in your diagram, but if not, choose another one.

Edit:

Can I: 1) merge bug-fix branch into master (preferably as squash commit)

Why not?

2) tag the head of bug-fix branch as v1.0.1

Why not? I would do that first, just because that commit is very easy to find just now.

3) delete bugfix-branch (but keep tag v1.0.1 in tact)?

Why not? bugfix-branch is just another name for this commit. They are all just names!

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • I've edited the question to hopefully make clearer. I realise a tag is just a label for a commit, though this has made me re-think my wording, and come up with a possible solution! – Jonny May 14 '20 at 11:56
  • 1
    If you read my answer, you will find that it answers your new questions. “I realise a tag is just a label for a commit” I don’t think you do. If you did, you wouldn’t have a question. – matt May 14 '20 at 11:57