Creating a tag:
$ git tag -a [tag] -m "[tag]" $ git push origin --tags
Deleting a tag:
$ git tag -d [tag] $ git push origin :tags/[tag]
Creating a tag:
$ git tag -a [tag] -m "[tag]" $ git push origin --tags
Deleting a tag:
$ git tag -d [tag] $ git push origin :tags/[tag]
So you’ve pushed a few (or more) bad commits in a row, and you want to throw away those changes. Sometimes it helps to jump straight back to a previous commit.
Try it out:
# Check that "git status" is clean: $ git status # Set the index (staging area) to be as it was at commit db0bc: $ git read-tree db0bc # Create a commit based on that index: $ git commit -m "Going back to the state at commit db0bc" # Your working tree will still be as it was when you started, so # you'll want to reset that to the new commit: $ git reset --hard
Code courtesy of Mark Longair over at Stack Overflow.