Tuesday 29 September 2015

Part 6 - git skim : Miscellenious (tag, checkout)

git tag:

You can name specific point in histories using "git tag".

Creating tags:
Two different kind of tags can be created
  1. annotated tags : Annotated tags, however, are stored as full objects in the Git database. They’re checksummed; contain the tagger name, email, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG).
    git tag --annotate v1.0 --message "My v1.0 tag"
  1. lightweight tag : much like a branch that doesn’t change – it’s just a pointer to a specific commit.
    git tag v1.0-lw
    
Listing tags:
List ALL existing tags
git tag --list
List tags according to given pattern
git tag --list "*-lw"

Show tag information:
git show "v1.0"
git show "v1.0-lw"
You will see the difference in how git shows "annotated" vs "lightweight" tag.

Tagging Later:
You can not only tag most recent commit but you also CAN tag some older commit. 
$ > git log --oneline
c42a629 Fate supporting changes to Gcloud
3a85978 Fixed the formatting problem in gc_helpers.sh.in poll_cmd
31d0dcb K2 requires corelib to be installed beforehand
4f4870c Fixing Baltoros version pick

To tag "Fixing Baltoros version pick", You can proceed as follow
git tag --annotate v0.9 4f4870c

Sharing tags:
Routine "git push" will NOT push the tags. To push tag, do following
git push origin v1.0
In case, you have multiple tags to push simultaneously, you can do as following
git push origin --tags

No comments:

Post a Comment