Is there a way to find the important commits in GIT before a release?
Since Git won't know which commits are important to you, you'll have to first define your own set of guidelines/format on how you write your commit messages, which you can then use later on to easily differentiate all the commits made for a particular development period.
- If it's a bug fix, prepend the commit message with a "[bugfix]"
- If it's a new feature, prepend the commit message with a "[feature]"
- If it's a project setup change, prepend the commit message with a "[migration]"
Then, once all the branches have been merged to the main branch (let's say it's develop), checkout the develop branch and use
git log --grep=<PATTERN> to identify a specific set of commits.
For example, if you only need the bug fix commits, do a:
git log --grep="bugfix"
which will show you all the commits with "bugfix" in the commit message.
If you only need the commits for a specific period, you can use the
git log --since="2017-06-01" --grep="bugfix"
If you want a formatted list (something that you can easily output to some sort of release notes, I assume), you can use the
git log --since="2017-06-01" --grep="bugfix" --format="(%ci) %h : %s"
The command above will give you something like this:
(2017-06-18 18:26:36 +0800) 63f330f : [bugfix] prevent crash when dialog is sent to background (2017-07-01 10:03:40 +0800) cdcbd91 : [bugfix] remove extra row at the end of the list
Basically, it will all depend on your commit message format.
As a tip, you can look into using a
commit.template to make it easier to format your commit messages.
Автор: Gino Mempin Размещён: 27.08.2017 11:10
If you set this to the path of a file on your system, Git will use that file as the default message when you commit. For instance, suppose you create a template file at
~/.gitmessage.txtthat looks like this: