Generating release notes from git commits
up vote
1
down vote
favorite
I've created the following rake task below to generate our release notes for each sprint.
I'm pulling in all commits to master
older than 2 weeks.
The problem is when a branch has been developed on for more than 2-week sprints, the older commits won't be included.
Can anyone suggest a way I can get these commits in?
task :new_release_note do
puts "Creating new release note"
puts "..."
git_log = `git log --since="two weeks ago" --no-merges --format=%B`
git_log.gsub!(/^$n/, '')
git_log.gsub!(/^/, "* ")
current_time = DateTime.now
current_date = current_time.strftime "%Y-%m-%d"
current_date_UK = current_time.strftime "%d-%m-%Y"
template = "__Release Notes__
=======================
#{current_date_UK}
__New Features__
----------------
* -
__Improvements__
----------------
* -
__Fixes__
---------
* -
__Change Log__
----------------
Detailed release notes below, listing all commit messages for this release.
#{git_log}
"
out_file = File.new("./doc/release_notes/release-notes-#{current_date}.md", "w")
out_file.puts(template)
if File.exist?(out_file)
puts "New release note generated successfully at /doc/release-notes/release-notes-#{current_date}.md"
else
puts "Error - file not generated."
end
end
ruby git rake
add a comment |
up vote
1
down vote
favorite
I've created the following rake task below to generate our release notes for each sprint.
I'm pulling in all commits to master
older than 2 weeks.
The problem is when a branch has been developed on for more than 2-week sprints, the older commits won't be included.
Can anyone suggest a way I can get these commits in?
task :new_release_note do
puts "Creating new release note"
puts "..."
git_log = `git log --since="two weeks ago" --no-merges --format=%B`
git_log.gsub!(/^$n/, '')
git_log.gsub!(/^/, "* ")
current_time = DateTime.now
current_date = current_time.strftime "%Y-%m-%d"
current_date_UK = current_time.strftime "%d-%m-%Y"
template = "__Release Notes__
=======================
#{current_date_UK}
__New Features__
----------------
* -
__Improvements__
----------------
* -
__Fixes__
---------
* -
__Change Log__
----------------
Detailed release notes below, listing all commit messages for this release.
#{git_log}
"
out_file = File.new("./doc/release_notes/release-notes-#{current_date}.md", "w")
out_file.puts(template)
if File.exist?(out_file)
puts "New release note generated successfully at /doc/release-notes/release-notes-#{current_date}.md"
else
puts "Error - file not generated."
end
end
ruby git rake
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I've created the following rake task below to generate our release notes for each sprint.
I'm pulling in all commits to master
older than 2 weeks.
The problem is when a branch has been developed on for more than 2-week sprints, the older commits won't be included.
Can anyone suggest a way I can get these commits in?
task :new_release_note do
puts "Creating new release note"
puts "..."
git_log = `git log --since="two weeks ago" --no-merges --format=%B`
git_log.gsub!(/^$n/, '')
git_log.gsub!(/^/, "* ")
current_time = DateTime.now
current_date = current_time.strftime "%Y-%m-%d"
current_date_UK = current_time.strftime "%d-%m-%Y"
template = "__Release Notes__
=======================
#{current_date_UK}
__New Features__
----------------
* -
__Improvements__
----------------
* -
__Fixes__
---------
* -
__Change Log__
----------------
Detailed release notes below, listing all commit messages for this release.
#{git_log}
"
out_file = File.new("./doc/release_notes/release-notes-#{current_date}.md", "w")
out_file.puts(template)
if File.exist?(out_file)
puts "New release note generated successfully at /doc/release-notes/release-notes-#{current_date}.md"
else
puts "Error - file not generated."
end
end
ruby git rake
I've created the following rake task below to generate our release notes for each sprint.
I'm pulling in all commits to master
older than 2 weeks.
The problem is when a branch has been developed on for more than 2-week sprints, the older commits won't be included.
Can anyone suggest a way I can get these commits in?
task :new_release_note do
puts "Creating new release note"
puts "..."
git_log = `git log --since="two weeks ago" --no-merges --format=%B`
git_log.gsub!(/^$n/, '')
git_log.gsub!(/^/, "* ")
current_time = DateTime.now
current_date = current_time.strftime "%Y-%m-%d"
current_date_UK = current_time.strftime "%d-%m-%Y"
template = "__Release Notes__
=======================
#{current_date_UK}
__New Features__
----------------
* -
__Improvements__
----------------
* -
__Fixes__
---------
* -
__Change Log__
----------------
Detailed release notes below, listing all commit messages for this release.
#{git_log}
"
out_file = File.new("./doc/release_notes/release-notes-#{current_date}.md", "w")
out_file.puts(template)
if File.exist?(out_file)
puts "New release note generated successfully at /doc/release-notes/release-notes-#{current_date}.md"
else
puts "Error - file not generated."
end
end
ruby git rake
ruby git rake
edited Nov 9 at 22:49
CodeWizard
49.1k126688
49.1k126688
asked Nov 9 at 22:01
s89_
819
819
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
Can anyone suggest a way I can get these commits in?
Few options:
git tag
git notes
git whatchanged
git tag
Read this answer on what is git tag and how to use it: What is git tag, How to create tags & How to checkout git remote tag(s)
In short: git tag allows you to mark commit which can be later on to perform your merge. As you know
git pull = git fetch + git merge
So once you have marked your last merge with the tag you can pull out all the changes form the last merge
# "Merge" the last X commits based upon your previous tag
git cherry-pick <tag_name>..master
git notes
git notes
allow us to add content to commit without updating the SHA-1 of the commit, meaning we can attach content to the commit while leaving the SHA-1 unmodified.
Now once you have your notes you can find out the last commit which you "merged" previously and grab the changes from this point on using the above cherry-pick
.
You can search and find your notes with git log --grep
git whatchanged
Once you what is your referenced commit you can see the list of files which were updated during this time period with the git whatchanged
command
# Print out a list of files which was updated/added between the 2 commits
git whatchanged <TAG_NAME>...HEAD
1
Thanks, CodeWizard! I'd experimented with using tags and notes before for our versioning and releases but haven't come acrossgit whatchanged
before - this should help. Thanks again!
– s89_
Nov 10 at 17:15
1
cool, good luck
– CodeWizard
Nov 10 at 17:26
add a comment |
up vote
0
down vote
Consider using git tag
and tag your releases with version numbers. What my team does is to create a release branch with a version number for each release i.e. release-2.5.8
and when the release is ready, it gets merged into master
. Then we tag that merge commit with a version number i.e. v2.5.8
If you do this, along with squash merges then to see all the related commits it's as easy as doing:
git log v2.5.8...v2.5.9
Which will show you all the commits within those 2 releases.
The reason I recommend squash merging your feature branch is for exactly your use case. You want to know what was done during the dev of that feature, but how can you just by date? You really can't. So when your feature is ready to be merged into your release, if you squash merge, you can keep all the notes in a single commit for the merge of that feature. The idea here is you keep what is relevant and discard what is no longer needed during development.
You might also want to check out Gitflow
1
I updated my answer because I realizedgit lg
is an alias I have setup in my~/.gitconfig
file. Answer changed to use the standardgit log
. Also fixed mistake in semantic version tag example
– lacostenycoder
Nov 10 at 10:49
1
Hey, thanks. Looks like tagging will help us. I've got our team on board with Git flow a while ago but still trying to fully integrate it into our practices. Definitely the way to go.
– s89_
Nov 10 at 17:35
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Can anyone suggest a way I can get these commits in?
Few options:
git tag
git notes
git whatchanged
git tag
Read this answer on what is git tag and how to use it: What is git tag, How to create tags & How to checkout git remote tag(s)
In short: git tag allows you to mark commit which can be later on to perform your merge. As you know
git pull = git fetch + git merge
So once you have marked your last merge with the tag you can pull out all the changes form the last merge
# "Merge" the last X commits based upon your previous tag
git cherry-pick <tag_name>..master
git notes
git notes
allow us to add content to commit without updating the SHA-1 of the commit, meaning we can attach content to the commit while leaving the SHA-1 unmodified.
Now once you have your notes you can find out the last commit which you "merged" previously and grab the changes from this point on using the above cherry-pick
.
You can search and find your notes with git log --grep
git whatchanged
Once you what is your referenced commit you can see the list of files which were updated during this time period with the git whatchanged
command
# Print out a list of files which was updated/added between the 2 commits
git whatchanged <TAG_NAME>...HEAD
1
Thanks, CodeWizard! I'd experimented with using tags and notes before for our versioning and releases but haven't come acrossgit whatchanged
before - this should help. Thanks again!
– s89_
Nov 10 at 17:15
1
cool, good luck
– CodeWizard
Nov 10 at 17:26
add a comment |
up vote
3
down vote
accepted
Can anyone suggest a way I can get these commits in?
Few options:
git tag
git notes
git whatchanged
git tag
Read this answer on what is git tag and how to use it: What is git tag, How to create tags & How to checkout git remote tag(s)
In short: git tag allows you to mark commit which can be later on to perform your merge. As you know
git pull = git fetch + git merge
So once you have marked your last merge with the tag you can pull out all the changes form the last merge
# "Merge" the last X commits based upon your previous tag
git cherry-pick <tag_name>..master
git notes
git notes
allow us to add content to commit without updating the SHA-1 of the commit, meaning we can attach content to the commit while leaving the SHA-1 unmodified.
Now once you have your notes you can find out the last commit which you "merged" previously and grab the changes from this point on using the above cherry-pick
.
You can search and find your notes with git log --grep
git whatchanged
Once you what is your referenced commit you can see the list of files which were updated during this time period with the git whatchanged
command
# Print out a list of files which was updated/added between the 2 commits
git whatchanged <TAG_NAME>...HEAD
1
Thanks, CodeWizard! I'd experimented with using tags and notes before for our versioning and releases but haven't come acrossgit whatchanged
before - this should help. Thanks again!
– s89_
Nov 10 at 17:15
1
cool, good luck
– CodeWizard
Nov 10 at 17:26
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Can anyone suggest a way I can get these commits in?
Few options:
git tag
git notes
git whatchanged
git tag
Read this answer on what is git tag and how to use it: What is git tag, How to create tags & How to checkout git remote tag(s)
In short: git tag allows you to mark commit which can be later on to perform your merge. As you know
git pull = git fetch + git merge
So once you have marked your last merge with the tag you can pull out all the changes form the last merge
# "Merge" the last X commits based upon your previous tag
git cherry-pick <tag_name>..master
git notes
git notes
allow us to add content to commit without updating the SHA-1 of the commit, meaning we can attach content to the commit while leaving the SHA-1 unmodified.
Now once you have your notes you can find out the last commit which you "merged" previously and grab the changes from this point on using the above cherry-pick
.
You can search and find your notes with git log --grep
git whatchanged
Once you what is your referenced commit you can see the list of files which were updated during this time period with the git whatchanged
command
# Print out a list of files which was updated/added between the 2 commits
git whatchanged <TAG_NAME>...HEAD
Can anyone suggest a way I can get these commits in?
Few options:
git tag
git notes
git whatchanged
git tag
Read this answer on what is git tag and how to use it: What is git tag, How to create tags & How to checkout git remote tag(s)
In short: git tag allows you to mark commit which can be later on to perform your merge. As you know
git pull = git fetch + git merge
So once you have marked your last merge with the tag you can pull out all the changes form the last merge
# "Merge" the last X commits based upon your previous tag
git cherry-pick <tag_name>..master
git notes
git notes
allow us to add content to commit without updating the SHA-1 of the commit, meaning we can attach content to the commit while leaving the SHA-1 unmodified.
Now once you have your notes you can find out the last commit which you "merged" previously and grab the changes from this point on using the above cherry-pick
.
You can search and find your notes with git log --grep
git whatchanged
Once you what is your referenced commit you can see the list of files which were updated during this time period with the git whatchanged
command
# Print out a list of files which was updated/added between the 2 commits
git whatchanged <TAG_NAME>...HEAD
edited Nov 10 at 7:48
answered Nov 9 at 23:05
CodeWizard
49.1k126688
49.1k126688
1
Thanks, CodeWizard! I'd experimented with using tags and notes before for our versioning and releases but haven't come acrossgit whatchanged
before - this should help. Thanks again!
– s89_
Nov 10 at 17:15
1
cool, good luck
– CodeWizard
Nov 10 at 17:26
add a comment |
1
Thanks, CodeWizard! I'd experimented with using tags and notes before for our versioning and releases but haven't come acrossgit whatchanged
before - this should help. Thanks again!
– s89_
Nov 10 at 17:15
1
cool, good luck
– CodeWizard
Nov 10 at 17:26
1
1
Thanks, CodeWizard! I'd experimented with using tags and notes before for our versioning and releases but haven't come across
git whatchanged
before - this should help. Thanks again!– s89_
Nov 10 at 17:15
Thanks, CodeWizard! I'd experimented with using tags and notes before for our versioning and releases but haven't come across
git whatchanged
before - this should help. Thanks again!– s89_
Nov 10 at 17:15
1
1
cool, good luck
– CodeWizard
Nov 10 at 17:26
cool, good luck
– CodeWizard
Nov 10 at 17:26
add a comment |
up vote
0
down vote
Consider using git tag
and tag your releases with version numbers. What my team does is to create a release branch with a version number for each release i.e. release-2.5.8
and when the release is ready, it gets merged into master
. Then we tag that merge commit with a version number i.e. v2.5.8
If you do this, along with squash merges then to see all the related commits it's as easy as doing:
git log v2.5.8...v2.5.9
Which will show you all the commits within those 2 releases.
The reason I recommend squash merging your feature branch is for exactly your use case. You want to know what was done during the dev of that feature, but how can you just by date? You really can't. So when your feature is ready to be merged into your release, if you squash merge, you can keep all the notes in a single commit for the merge of that feature. The idea here is you keep what is relevant and discard what is no longer needed during development.
You might also want to check out Gitflow
1
I updated my answer because I realizedgit lg
is an alias I have setup in my~/.gitconfig
file. Answer changed to use the standardgit log
. Also fixed mistake in semantic version tag example
– lacostenycoder
Nov 10 at 10:49
1
Hey, thanks. Looks like tagging will help us. I've got our team on board with Git flow a while ago but still trying to fully integrate it into our practices. Definitely the way to go.
– s89_
Nov 10 at 17:35
add a comment |
up vote
0
down vote
Consider using git tag
and tag your releases with version numbers. What my team does is to create a release branch with a version number for each release i.e. release-2.5.8
and when the release is ready, it gets merged into master
. Then we tag that merge commit with a version number i.e. v2.5.8
If you do this, along with squash merges then to see all the related commits it's as easy as doing:
git log v2.5.8...v2.5.9
Which will show you all the commits within those 2 releases.
The reason I recommend squash merging your feature branch is for exactly your use case. You want to know what was done during the dev of that feature, but how can you just by date? You really can't. So when your feature is ready to be merged into your release, if you squash merge, you can keep all the notes in a single commit for the merge of that feature. The idea here is you keep what is relevant and discard what is no longer needed during development.
You might also want to check out Gitflow
1
I updated my answer because I realizedgit lg
is an alias I have setup in my~/.gitconfig
file. Answer changed to use the standardgit log
. Also fixed mistake in semantic version tag example
– lacostenycoder
Nov 10 at 10:49
1
Hey, thanks. Looks like tagging will help us. I've got our team on board with Git flow a while ago but still trying to fully integrate it into our practices. Definitely the way to go.
– s89_
Nov 10 at 17:35
add a comment |
up vote
0
down vote
up vote
0
down vote
Consider using git tag
and tag your releases with version numbers. What my team does is to create a release branch with a version number for each release i.e. release-2.5.8
and when the release is ready, it gets merged into master
. Then we tag that merge commit with a version number i.e. v2.5.8
If you do this, along with squash merges then to see all the related commits it's as easy as doing:
git log v2.5.8...v2.5.9
Which will show you all the commits within those 2 releases.
The reason I recommend squash merging your feature branch is for exactly your use case. You want to know what was done during the dev of that feature, but how can you just by date? You really can't. So when your feature is ready to be merged into your release, if you squash merge, you can keep all the notes in a single commit for the merge of that feature. The idea here is you keep what is relevant and discard what is no longer needed during development.
You might also want to check out Gitflow
Consider using git tag
and tag your releases with version numbers. What my team does is to create a release branch with a version number for each release i.e. release-2.5.8
and when the release is ready, it gets merged into master
. Then we tag that merge commit with a version number i.e. v2.5.8
If you do this, along with squash merges then to see all the related commits it's as easy as doing:
git log v2.5.8...v2.5.9
Which will show you all the commits within those 2 releases.
The reason I recommend squash merging your feature branch is for exactly your use case. You want to know what was done during the dev of that feature, but how can you just by date? You really can't. So when your feature is ready to be merged into your release, if you squash merge, you can keep all the notes in a single commit for the merge of that feature. The idea here is you keep what is relevant and discard what is no longer needed during development.
You might also want to check out Gitflow
edited Nov 10 at 10:45
answered Nov 9 at 22:19
lacostenycoder
3,56511226
3,56511226
1
I updated my answer because I realizedgit lg
is an alias I have setup in my~/.gitconfig
file. Answer changed to use the standardgit log
. Also fixed mistake in semantic version tag example
– lacostenycoder
Nov 10 at 10:49
1
Hey, thanks. Looks like tagging will help us. I've got our team on board with Git flow a while ago but still trying to fully integrate it into our practices. Definitely the way to go.
– s89_
Nov 10 at 17:35
add a comment |
1
I updated my answer because I realizedgit lg
is an alias I have setup in my~/.gitconfig
file. Answer changed to use the standardgit log
. Also fixed mistake in semantic version tag example
– lacostenycoder
Nov 10 at 10:49
1
Hey, thanks. Looks like tagging will help us. I've got our team on board with Git flow a while ago but still trying to fully integrate it into our practices. Definitely the way to go.
– s89_
Nov 10 at 17:35
1
1
I updated my answer because I realized
git lg
is an alias I have setup in my ~/.gitconfig
file. Answer changed to use the standard git log
. Also fixed mistake in semantic version tag example– lacostenycoder
Nov 10 at 10:49
I updated my answer because I realized
git lg
is an alias I have setup in my ~/.gitconfig
file. Answer changed to use the standard git log
. Also fixed mistake in semantic version tag example– lacostenycoder
Nov 10 at 10:49
1
1
Hey, thanks. Looks like tagging will help us. I've got our team on board with Git flow a while ago but still trying to fully integrate it into our practices. Definitely the way to go.
– s89_
Nov 10 at 17:35
Hey, thanks. Looks like tagging will help us. I've got our team on board with Git flow a while ago but still trying to fully integrate it into our practices. Definitely the way to go.
– s89_
Nov 10 at 17:35
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233810%2fgenerating-release-notes-from-git-commits%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown