JohnSmith
JohnSmith

Reputation: 4688

tags and merging of branches

I tag master at time T, and I have a branch that contains modifications that took place before time T.

When I do a merge of the branch into the master, does this mean that those changes will be merged in before the tag, so if I want to checkout the state that was tagged, I will also gets the merged code?

Ideally I would like to tag (or use something similar) the master, so that I will get the state as it was when I was tagging it, i.e. without the merged code.

Upvotes: 2

Views: 144

Answers (2)

Wolf
Wolf

Reputation: 4452

If you tag master, and then merge anything into master after that: when you checkout your tag you will get exactly what you tagged and none of the subsequently merged commits. That is, nothing that happens after you tag affects the the tag you just made.

Upvotes: 1

janos
janos

Reputation: 124656

A tag is like an alias or bookmark to a specific commit. It has nothing to do with time.

You can do whatever you want in your branch, because there's nothing you can do to change that commit (except erasing the commit).

When later you checkout that tag, you will get files at exactly the same state as they were when you tagged that commit.

Upvotes: 1

Related Questions