What about Tags?

Learn about “tags” in Git.

We'll cover the following

Let’s cover “off tags” really quickly while we’re here.


Tags are the same as branches, except they do not have history. They point to a particular commit, but it doesn’t change (unless you force a change, or delete it).

How to apply tags?

You can tag something where you are:

1	git tag i_was_here

Or you can tag wherever a branch pointer is pointed at in your repository, even if you are not on it:

2	git checkout e36355ed00ac3af009d7113a9dd281c269a79afd
3	git branch -f newfeature

The -f flag means --force. If a branch of newfeature already exists, then Git will not allow you to override it unless you use the -f flag.

4	git checkout master
5	git tag remember_to_tell_bob_to_rewrite_this newfeature

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy