Git: Understanding Git logs and Git tags

Share At:

Git Log:

Git log comes handy when you want to keep track of history of commits you have made to your code.

Running “git log” will basically show you the history of commits made by you.

The command “git log — oneline” with show shorter version of commits in one line.

If you want to get some more info from the logs, use following command (git log — oneline — decorate –graph) instead:

Git Tag:

Git tags are useful when there are multiple commits and its pretty hard to keep track of all the changes made through commit id. In that case , we can associate the commit ids with “tags”.

  1. “git log” will show all the commits made:

2. Below command will create a tag called “v1” and associate itself with latest commit:

3. “git tag” will show that tag “v1” was created:

4. “git show v1” will show the tag details:

5. Now if you want to create another tag called “v2” and associate it with other commit id, use following command: “git tag -a v2 <Commit ID> -m <Message you want to put>.

( Here: [root@git infra-automation2]# git tag -a v2 e3f268d99b3399fc512085ae44de0443db61e733 -m “next version of release”)

6. “git tag” command will show that tag “v2” has been created.

7. “git show v2” will show details about tag “v2”:

Happy Learning !!


Share At:
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Back To Top

Contact Us