How do I create a tag in GitHub without creating a release?

Viewed 5968

I am about to make a major technology change to my project, moving from ANT to Gradle. There has never been a release of this project -- it is still in development. I would like to tag the last old technology version so that it can be found for reference or reversion. But I don't want to imply that there is any kind of release.

[AN ADDED THOUGHT: I would expect some interested person to see a release and think that it might be a usable "release". That is, I'm thinking releases are for users and tags are for developers. ]

I would prefer an answer that does not require me to drop into the Git command line, but if that's necessary, please assume that I have forgotten what little I ever did attempt to learn.

In a comment on an answer to the question create-a-tag-in-a-github-repository, @RandomDSdevel says:

[S]houldn't you be able to create tags that don't automatically get picked up by GitHub as releases…?

Then

I submitted a support request to GitHub about this a while ago, but they had a bit of a support backlog back then, so my request was closed.

3 Answers

The easiest solution would be to create a release (in the GitHub UI), and then delete the release.
This will only delete the release, but the tag will remain still, which would be the solution to your problem.

Hope this is useful to you.

Summarizing my experience so far using GitHub to create a tag without a release:

I can create a release, but it requires my tag name to have a version at the start, like

v0.0-MyTagName

If I delete the release, the tag still shows up under the list of tags (and the list of releases, but at least it doesn't show up in the headline type that it did as a release).

At this point I can edit the tag name to get rid of the "v0.0-", leaving the name that I really want. It looks like it switches you to editing a release, but it stays as a tag unless you add a title. Now it doesn't look like a release, even though the tag name shows up in the list of releases.

Using git instead of GitHub, you may be able to do more.

I could not find the tags or releases in GitHub Desktop. If you just want to look at the code at a branch, you will have to do that online. If you want to modify the code at the tag, you need to create a branch, of course. Branches are visible in GitHub Desktop.

I wish I had just done it in a branch.

It's not too late, and without losing any history.

Make a branch off master now, that will have your Ant -> Gradle work.

git branch ant_to_gradle master

Move master back to the last stable commit.

git checkout master
git reset --hard <last stable commit>

Gently force push the reset master branch.

git push --force-with-lease

Continue to work on ant_to_gradle and leave master alone.

Yes, that involves dropping into the command line. There are Git apps which will do this for you, I like GitUp, but my advice is to get comfortable with the command line. Apps are useful, but limiting.

But that still leaves the question of tagging the pre-merge master version just in case I want to refer to it later.

You could tag it locally and not push the tag.

You could tag it and trust that if someone sees a release called pre-gradle they know what they're getting into. You can also edit a release to mark it a pre-release.

But my advice is to not litter your repo with "just in case I need it" tags and instead make searchable commits and get comfortable searching history; because you won't always think to make a tag. If you merge your work in a Pull Request, Github will produce a consistent merge commit message like Merge pull request #1859 from ant_to_gradle. Then you can search for that to find the merge commit and look backwards.

Related