Skip to content

Instantly share code, notes, and snippets.

@danielestevez
Last active April 10, 2024 07:51
Show Gist options
  • Save danielestevez/2044589 to your computer and use it in GitHub Desktop.
Save danielestevez/2044589 to your computer and use it in GitHub Desktop.
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
3) Delete and recreate the tag locally
git tag -d {tagname}
git tag {tagname}
4) Delete and recreate the tag remotely
git push origin :{tagname} // deletes original remote tag
git push origin {tagname} // creates new remote tag
5) Update local repository with the updated tag (suggestion by @wyattis)
git fetch --tags
This is based on https://gist.github.com/739288 thanks to nickfloyd for it
@i-vyshnevska
Copy link

thanks 👍

@righdforsa
Copy link

🎉 Big help, thanks.

@reemuru
Copy link

reemuru commented Jul 27, 2021

dope 🔥

@maxcotec
Copy link

maxcotec commented Sep 6, 2021

Amazoning!

@Thomas-Ripoll
Copy link

Very usefull for minor fixes! thx

@dkkahn10
Copy link

Many thanks!

@xujq1
Copy link

xujq1 commented Nov 21, 2021

It is very helpful , thanks a lot

@Mreyna3
Copy link

Mreyna3 commented Nov 22, 2021

5 years later, Saved me a couple hours

@willinivelics
Copy link

Thanks so much!!

@abbathaw
Copy link

abbathaw commented Jan 6, 2022

Thanks

@geerlingguy
Copy link

Saved me a few hours futzing around trying to update a dozen or so tags. Feels totally wrong and against the idea of tag in the first place, but sometimes tags just don't work the exact way a project requires!

@uncannyMBM
Copy link

Thanks a lot.

@Lissy93
Copy link

Lissy93 commented May 21, 2022

Felt a bit wrong deleting my tag remotely, but worked out perfectly. Thanks very much!
Side note, everywhere I go on the internet, I seem to see traces of @geerlingguy pop up! 🤣

@chairwa
Copy link

chairwa commented May 28, 2022

Thanks.

@hotstar-xia
Copy link

Thanks!!

@rproenza86
Copy link

It is still relevant. Thanks!!!

@robertmin1
Copy link

Thanks

@AZPedro
Copy link

AZPedro commented Feb 14, 2023

Thanks!

@zomars
Copy link

zomars commented Mar 20, 2023

Noice

@lmurugesan-px
Copy link

Thanks a lot

@mahedi-anik-asl
Copy link

It is still relevant. Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment