This post was originally posted in the newsletter GitBetter. If you are interested in leveling up your game in Git, you can subscribe to it.
If you are working on several repos or in a large team on a daily basis then keep tracking what is being done and who is working on which feature can be something daunting.
But fortunately, Git helps us to track the changes in the repo so that you view this information in simple commands.
Using git shortlog
Git shortlog is similar to git log but the commits will be grouped by author and title.
For example,
git shortlog
In the above image, you can see that the git logs are grouped by author name and with the number of commit numbers.
This helps you to see which author has worked on which commit.
Using date range
Shortlog comes with numerous options. One of the most important options is using a date range.
git shortlog --after="1 week ago" --before="1 day"
—after include commits more recent than the date.
—before include commits older than the date.
You can use other options of date as well
git shortlog --after="yesterday" git shortlog --after="today" git shortlog --after="10 days ago" git shortlog --after="1 week ago"
Using the commit range
Sometimes you need to look for the history in the specified commit range.
git shortlog A..B git shortlog 143fd1fa..9215d04f
Remember that A commit hash should be older than commit hash B
Filter by files
Shortlog also provides an option to filter by only specified files.
git shortog -- one.txt
The above option will filter commits that contain changes from the specified file.
git shortlog -- one.txt two.txt three.txt
You can also specify multiple files.
Formatting git shortlog
You can also use the formatting options for shortlog. The format options are the same as the git log.
Usage
git shortlog --pretty=format:"%an - %ar%n %h - %s %n"
You can view other format options here
Git standup
To make things easier, there is a tool called git-standup
Git standup is an open-source tool that helps you to track what you have been working on and what your team has been working on. It comes with various options that you can play with it.
Thank you for reading :)
This post was originally posted in the newsletter GitBetter. If you are interested in leveling up your game in Git, you can subscribe to it.
Top comments (0)