41

I recently released a new version of my project on Github by clicking the release button, on the right-hand side of the page. However, I found something error in my code, so, I just fixed and committed it.

Now, I would like to change my latest release in order to include my latest commit. I tried to remove the release and recreate it once again using the same tag name, however, it still points to the previous commit. I have been googling but still no luck. Any help would be appreciated.

lvarayut
  • 13,963
  • 17
  • 63
  • 87

1 Answers1

58

You would need to update/move the tag locally first, and force push it (as in here):

# assuming you are in the branch referencing currently the right new commit:
git tag -f <tagname>

# push your new commit:
git push 

# force push your moved tag:
git push origin -f <tagname>

Then you can go on GitHub and associate new binaries with the release for that tag (which should point to the right commit).

Nick McCurdy
  • 17,658
  • 5
  • 50
  • 82
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It works. However it does not make the composer to detect updates in the repository version so the commits you make after previous release are not shared with users who have it installed. The only way there is to `composer remove` the module and re-install it. I think if you want to share the updates its better to make a new release. I am not sure if there is another way to do it. – Arvind K. Oct 20 '19 at 13:32
  • 1
    @ArvindK. Do you mean this composer? (https://getcomposer.org/). If so, I agree, but this 4+ years old answer was not written in a PHP context. – VonC Oct 20 '19 at 14:10
  • @VonC I agree. It is not related to composer so answer is alright. I was just curious. This answer answers what it is supposed to. – Arvind K. Oct 20 '19 at 16:22
  • 1
    Force pushing all the tags could have unintended consequences. `git push origin -f {TAG_NAME}` is safer. – Paul Beusterien Feb 16 '21 at 00:33
  • 2
    @PaulBeusterien Good point. I have edited the answer accordingly. – VonC Feb 16 '21 at 08:05
  • @PaulBeusterien And thank you for the edit on my edit... I barely know how to type ;) – VonC Feb 16 '21 at 15:14