What happens to tags of squashed commits?

The tags won't move because a rebase rewrites history. The original commits will have the tags since tags don't move. Here's a picture:

Before:

(HEAD) B - tag-B
       |
       A - tag-A
       |
       X

After:

         B - tag-B
         |
(HEAD) C A - tag-A
       |/
       X

Here C is the squash of A and B. It starts a completely new history, in which A and B will not participate. The branch head will move over to C and will proceed from there.


Will both be assigned to the squashed commit?

No.

Each tag points to a specific commit, and it never moves away from that commit on its own. The commits that each tag was pointing to is still alive, just not in any of your branches.

Squashing two commits creates a separate new commit, only with the contents of the original commits. This new commit will not have any tag pointing to it.


You can manually move those two tags to point to your new commit:

git tag -f tag-A
git tag -f tag-B