![]() ![]() In this example, we’ll pass the -n flag to sort by the number of commits by author. shortlog groups commits by author, sorted by name. The shortlog command is especially useful when generating release notes for projects with many collaborators. You can find more formatting placeholders in the official git log documentation. 2c36613 feat: display post date in post header The %h placeholder denotes an abbreviated commit hash and the %s placeholder denotes the commit subject (or title). ![]() Each log entry is an item in a list of commits, so we’ll add a leading - to each line item, displaying the log as an unordered list in markdown. In this example, we’re going to alter the format of the log output so that it better integrates with markdown. Formatting the output involves passing the -format flag along with a formatting string and placeholders. Customize Log FormatĬustomizing the git log output is simple. This provides a convenient way to navigate to different points in a codebase’s history. Git log -oneline v0.7.0.v0.7.1 > CHANGELOGĪ benefit of generating release notes in this way is that GitHub will hyperlink commit hashes in release notes to the actual commit. This will append the contents of git log to the CHANGELOG file, or create it if it doesn’t exist. In this example, we’ll append it to a changelog. We can write this information to a changelog by directing output and appending to a file. $ git log -oneline v0.7.0.v0.7.1Ģc36613 feat: display post date in post headerĠcee78d style: updates in various md postsĪ5ad3d1 chore(deps): upgrade various depsģbee705 feat: remove google analytics scriptģ3e1a8a update: remove shell prompt symbol in jekyll-vue post code blocksĠ07595b feat: adjust styling of code blocks in postĮ5df77a feat: add hero image alt text field to post In this case, we’ll display only the commits between the previous tag v0.7.0 and the current tag v0.7.1. We can limit the range of the log by using the revision range argument. ![]() We pass the -oneline formatting flag to denote that we want a condensed version of each commit intended to fit one commit per line. In the following example, we use git log to generate a list of commits that for release notes. We can pare down this information using git log’s many options. Generate Basic Release Notesīy itself, the log command shows quite a bit of information, including the full commit hash, author name, and email, date, full commit message, etc. Pairing git log with clear and meaningful commit messages can be a powerful tool in the project documentation toolkit. Its output can generate project documentation such as release notes and changelogs. The git sub-command log shows the commits in a repository and is a useful tool for inspecting the history of a project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |