0

I have several commits, but once I release I'd like to associate a tag to it.

I know the relevant commands are commit, tag and push.

In which order should I do it - so that the last or the one I'm about to do is associated with the tag I'm about to push?

Would it be git commit, then git tag and then git push?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
dashman
  • 2,858
  • 3
  • 29
  • 51

2 Answers2

0

Yes, that's the right order - you first need to create a commit (git commit). Then tag it and give it a meaningful name (git tag). Once you've did that, push the commit and its tag to the remote repo (git push).

Mureinik
  • 297,002
  • 52
  • 306
  • 350
0

First:

  1. commit all you need with git add . && git commit -m "commit message"

Then:

  1. If you have several commits and you want to tag it all together:

    2.1. git rebase -i HEAD~<X>, where X is the number of commits

  2. Tagging: git tag <tag-name>, where tag-name is the tag you want
  3. If you have your commit pushed

    4.1. git push --follow-tags, as a good way to push your tag, as you can find here

  4. If not, you can push just one tag:

    5.1. git push origin <tag_name>

eduardogr
  • 391
  • 5
  • 16