2

I am trying to get list of commits between the last Tag and the Tag before it

Answers that I see here ( and that I currently use ) are like this:

git log --pretty=oneline TagA...TagB

But this forces me to know the tag numbers that are not available at this part of the build process

thus sometimes this command fails, stopping the build process

Build machine is a Windows machine, I have seen unix related answers

Any way to achieve that ?

0

2 Answers 2

5

Get the last tag in the current branch:

lasttag=`git describe --tags --abbrev=0`

Get the previous tag before the last:

prev_tag=`git describe --tags --abbrev=0 $lasttag~`

See the log:

git log $prev_tag..$lasttag
Sign up to request clarification or add additional context in comments.

1 Comment

what I ended up doing on windows: git describe --tags --abbrev=0 > tmpFile set /P lasttag= < tmpFile del tmpFile git describe --tags --abbrev=0 %lasttag%~ > tmpFile2 set /P prev_tag= < tmpFile2 del tmpFile2 git log %prev_tag%...%lasttag% >ReleaseNotes.txt
2

What I ended up doing on windows after looking on the first answer:

it describe --tags --abbrev=0 > tmpFile 
set /P lasttag= < tmpFile 
del tmpFile 

git describe --tags --abbrev=0 %lasttag%~ > tmpFile2
set /P prev_tag= < tmpFile2 
del tmpFile2

git log %prev_tag%...%lasttag% >ReleaseNotes.txt

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.