Skip to content

dreamcatcher45/Git-Usage-Analytics

Repository files navigation

Git Usage Analytics

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.

Table of Contents

  1. Features
  2. Installation
  3. Usage
  4. CSV Format Requirements
  5. Time Difference Calculation
  6. Limitations and Warnings
  7. License

Features

  • 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.

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/git-analytics.git
  2. Install dependencies (inside the project directory):
    npm install
  3. Start the development server:
    npm start
  4. Open your browser and navigate to:
    http://localhost:3000
    
    (Or the port displayed in your terminal if different.)

Usage

  1. 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
  2. Launch Git Usage Analytics and drag or select the dates.csv file in the upload box.
  3. Choose the desired view (Hourly, Daily, Weekly, Monthly, or Full Lifetime) from the dropdown menu next to the file upload button.
  4. 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.

CSV Format Requirements

  • Each line must follow the format:
    YYYY-MM-DD HH:mm:ss +ZZZZ
    
    For example:
    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.

Time Difference Calculation

Below is a simplified explanation of how the application calculates time differences:

  1. Parse each commit time string (YYYY-MM-DD HH:mm:ss +ZZZZ) into a Date object, adjusting the timezone offset to ISO format.
  2. Sort the Date objects in chronological order.
  3. 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).
  4. Classify each time difference as:
    • high if the difference is greater than 60 minutes.
    • low otherwise.
  5. Group consecutive commits with the same status to produce additional insights.

Limitations and Warnings

  • 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.

License

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.

About

Git Usage Analytics is a web-based tool to analyze your Git commit history and discover coding activity patterns.

Topics

Resources

Stars

Watchers

Forks