To collect Git commit history, you can use the following command in your terminal within a Git repository:
This command displays the commit history, including commit hashes, authors, dates, and messages.
For a Simplified View
You can use --oneline to get a compact version:
This shows each commit as a single line (commit hash and message).
Customize Output Format
To collect and format the commit history as needed (e.g., for exporting or parsing), use:
Explanation:
-
%h: abbreviated commit hash -
%an: author name -
%ar: relative date (e.g., 2 days ago) -
%s: commit message
Export to a File
To save the commit history to a file:
For Specific Branch
To get the commit history for a specific branch:
For Specific File
To view commit history of a particular file:
Let me know if you want to parse the commit data programmatically (e.g., in Python, Bash, etc.).