Question
Why can I not add a tag to two older commits?
git tag -a matlabTest cfa84dbb6dd3c2c9956421e723d2f99786f7b417
git tag -a matlabTest 45b3a4d83eece8a5adcb947392f15a14bd4b0e63
Instead I am getting:
fatal: tag 'matlabTest' already exists
It seems Git wants to just create a new tag rather than linking the tag to the commits? (see below for more detail).
Background
I have followed the guidelines in the git book: https://git-scm.com/book/en/v2/Git-Basics-Tagging, and here's what I tried (and failed):
I enter git log --pretty=oneline
, showing three commits:
cfa84dbb6dd3c2c9956421e723d2f99786f7b417 Preparing to make changes to changes.py to fix
45b3a4d83eece8a5adcb947392f15a14bd4b0e63 Tests: wholeseq analysis differs to Matlab
a894da22e2eb1c03930829622656ffd6da5ce161 Initial python scripts for analysis
I create a tag git tag -a matlabTest
and now I want to add "matlabTest" to two of the commits**. Specifically, the top and middle commit of the three shown above.
git tag -a matlabTest cfa84d
git tag -a matlabTest 45b3a4
Now in both cases I get the following error:
fatal: tag 'matlabTest' already exists
But when I show the 'matlabTest' flag by entering git show matlabTest
I see that only the first commit was successfully tagged, I have truncated output since it is long, but at the end of the output I cannot see that both commits were tagged:
tag matlabTest
Tagger: *foo (I did not want to show personal information)*
Date: Fri Nov 25 02:37:41 2016 +0200
After testing dnds.py by comparing whole-seq dN/dS output to MATLABs dnds() output, both using NG, dnds.py seems to have a calculation error. So I have started to make changes to changes.py
commit 45b3a4d83eece8a5adcb947392f15a14bd4b0e63
Author: *foo (I did not want to show personal information)*
Date: Fri Nov 25 02:20:27 2016 +0200
*...<remainder of script>*
Extra background
**Why do I want to tag the two older commits? Because there is some silent error (inconsistency with previous software I wrote in MATLAB) that I am trying to debug, and it is being caused by either one of two scripts (changes.py and dnds.py) and each has a different commit (cfa84db and 45b3a4d8) pointing to it. I want to tag both commits to help me treat this bug in a systematic way.