branch4 Blog

Internet development with every single possibility.

[Git] Tagging in Git

| Comments

These are some commands I use when taggin in git.

Or say…some commands I will be using, since I haven’t really started using them.

Work flow of git in my environment.

  • debugging in master branch
  • little bug fix in master branch
  • new branches for major fix/new features
(beware that I’m developing alone)

What I want to accomplish

  • I want to tag the source before releasing
  • I want to maintain files(add/delete/change revision) in exisisting tags
  • I want to accomplish this easily
  • I want to learn git
Maybe this is my goal for today.

And from what I’ve googled so far…
Tag in git doesn’t tag files. It tags to the commit.
So I’ll follow that rule.

What I want to accomplish(fixed)

  • I want to tag the source before releasing
  • I want to maintain existing tags (tag different commit)
  • I want to accomplish this easily
  • I want to learn git
OK, now I’ll list some commands I would probably use frequently.

Check each tags’ annotation

Check out what this tag’s for !
    $ git tag -n 

Edit annotations in existing tags

it looks like this command will overwrite a “tagname” with a “tagname”.
      $ git tag tagname tagname -f -m *annotation* 

Get diff of a tag and HEAD

    $ git diff tagname HEAD 

Get rough diff of a tag and HEAD

      $ git diff --stat --color tagname HEAD 

Tag HEAD

    $ git tag -a tagname
    $ git tag -a tagname -m "annotation" 

Tag commit

    $ git tag tagname commit 

Check changes in each commit

    $ git log --stat
    $ git log --numstat
    $ git log --numstate
    $ git log --name-status
    $ git log --name-only 

Check coresponding commit to a tag

    $ git show tagname 

Overall flow to what I want to accomplish

2patterns so far.

Pattern1

tag to HEAD!!!! pattern.
Execute the command in

Pattern2

Maintaining the tag(changing a commit in a tag) pattern.
That should do it.

Comments