Git Usage Analytics is a web-based tool designed to analyze commit timestamps from a Git repository. It provides charts, time-difference insights, and various grouping options (hourly, daily, weekly, monthly, or full lifetime) to help developers understand their coding activity patterns.
- Features
- Installation
- Usage
- CSV Format Requirements
- Time Difference Calculation
- Limitations and Warnings
- License
- File Upload: Upload a
.csv
file containing commit timestamps. - Charts:
- Line Chart showing total time differences grouped by hour/day/week/month or overall.
- Scatter Plot comparing grouped categories (e.g., hour blocks) against time differences.
- Conclusions:
- Displays grouped time differences (e.g., consecutive “low” or “high” intervals).
- Shows a summary of total time spent.
- Detailed Time Entries:
- Paginates a table of each commit’s timestamp, time difference from the previous commit, and a status (high or low).
- Modern UI:
- Clean, minimal, boxy design inspired by Apple-like 2019 aesthetics.
- Responsive layout for various screen sizes.
- Error Handling:
- Validates CSV format (
YYYY-MM-DD HH:mm:ss +ZZZZ
). - Limits processing to 1000 rows.
- Validates CSV format (
- Clone the repository:
git clone https://github.com/yourusername/git-analytics.git
- Install dependencies (inside the project directory):
npm install
- Start the development server:
npm start
- Open your browser and navigate to:
(Or the port displayed in your terminal if different.)
http://localhost:3000
- Generate your CSV file from a Git repository by running the following command in your repo (this will export commit timestamps):
git log --pretty=format:"%ad" --date=iso > dates.csv
- Launch Git Usage Analytics and drag or select the
dates.csv
file in the upload box. - Choose the desired view (Hourly, Daily, Weekly, Monthly, or Full Lifetime) from the dropdown menu next to the file upload button.
- Analyze the results:
- View line and scatter charts for an overview of time differences.
- Check the Total Time Difference card for aggregated insights.
- Use the Detailed Time Entries table to see each commit’s exact difference.
- Each line must follow the format:
For example:
YYYY-MM-DD HH:mm:ss +ZZZZ
2025-03-25 23:54:08 +0530 2025-03-25 23:50:32 +0530
- The application will display an error if the CSV file contains rows that do not match this format.
- A maximum of 1000 rows is allowed. Any more will result in an error.
Below is a simplified explanation of how the application calculates time differences:
- Parse each commit time string (
YYYY-MM-DD HH:mm:ss +ZZZZ
) into aDate
object, adjusting the timezone offset to ISO format. - Sort the
Date
objects in chronological order. - Compute time difference (in minutes) between each commit and the previous one:
- If it’s the first commit, the time difference is
0
. - Otherwise, the difference is
(currentCommitDate - previousCommitDate) / (1000 * 60)
.
- If it’s the first commit, the time difference is
- Classify each time difference as:
- high if the difference is greater than 60 minutes.
- low otherwise.
- Group consecutive commits with the same status to produce additional insights.
- Approximate: The results are approximate and should not be used for critical decision-making.
- Time Zone: Differences in time zone or local time adjustments may cause minor discrepancies.
- Limited Data: Only 1000 rows are processed to maintain performance.
- CSV Format: The application relies on a strict CSV date format. Inconsistent or malformed timestamps will produce errors.
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software in accordance with the terms of the MIT License.
Enjoy using Git Usage Analytics!
Contributions and feedback are always welcome.