Starting with Git on Linux (Part 6)

Starting with Git on Linux (Part 6) is part of the series Starting with Git on Linux. See all links of these series at the end of the article.

At Part 5 we discussed updating the repository to the newest commit and merging another branch to master branch.

In this part, we will talk about tagging, git logs and replacing local changes.

Let’s start with tagging. It is advisable to create tags for each software release. If you want to create a tag named 1.0.1 execute the following code in terminal:

$ git tag 1.0.1

To view the available tag just type:

$ git tag

Now let’s talk about logs. Logs serve to study repository history. To use logs type the command below:

$ got log

If you want you can add lots of parameters to customize the log and make it look like you want. For example if you need to add an author:

git log --author=linuxey

To see more possible parameters, you can use --help command.

git log --help

If you guys did something wrong you can replace local changes using the command:

git checkout -- filename

This command will replace the changes in your working tree with the last content.

If you want to drop and don’t want to use all your commits and local changs, fetch the latest from the server and point your local master branch at it by using these commands:

git fetch origin
git reset --hard origin/master

I hope that you guys have found these series helpful and after these series you can start working with Git using the Terminal in Linux.

This article is part of the following series.