Reputation: 2420
I have no idea where to start here so I haven't tried anything yet. Basically I want to get all tags (which are version numbers) sorted from most recent to oldest and generate a list of added files in a specific directory from one tag to the next. The files themselves are small markdown snippets and I'd like to put them all into one file with a heading for each tag.
Upvotes: 2
Views: 204
Reputation: 488163
git tag
lists all tags, but not in "version order"; you'll have to do your "version number sort" some other way. This can be arbitrarily hard since the marketing-and-sales people like to make sure no one can understand which version is which, so as to force customers to buy more versions. :-)
Assuming you have a list you can step through pairwise, e.g., something like:
versions="v0.01 v0.02 v1 v1.1alpha v1.1 v1.1a v3 \
vmarketing-name vdifferent-name \
v2.1-because-marketing-thinks-2-greater-than-3"
you can then do something like this (in sh / bash):
set -- $versions
prev=$1
shift
for tag in $versions; do
echo "$prev => $tag"
git diff $prev $tag --diff-filter=A --name-only -- this/dir
echo "----------------------------------"
done
How this works:
git diff
gets you the changes from one commit to another.$prev
and "this tag" $tag
git diff
to look only at path this/dir
git diff
to filter out changes other than A
dded-filesgit diff
to print only the file names(and then the echo adds a cut-line in case the changes are extensive or empty).
Upvotes: 3