acc capture
Capture recent git commits and optionally create work log entries from them.
Usage
acc capture [OPTIONS]
Options
Flag | Description |
---|---|
-n, --limit <NUMBER> | Maximum number of commits to display (default: 25) |
--edit | Open editor to write entry with pre-filled commit messages |
--link | Link captured commits to existing worklog entries instead of creating new ones |
Description
The capture
command helps bridge the gap between your git commits and work logging by:
- Reading recent git commits from the current repository
- Displaying commit information in a readable format
- Creating work log entries using commit messages as a starting point, or
- Linking commits to existing work log entries when using the
--link
flag
Examples
View Recent Commits
# Show last 25 commits (default)
acc capture
# Show last 10 commits
acc capture -n 10
# Show last 50 commits
acc capture -n 50
Create Work Log from Commits
# Open editor with commit messages pre-filled
acc capture --edit
# Show fewer recent commits for selection and open editor
acc capture -n 5 --edit
Link Commits to Existing Entries
# Link captured commits to existing worklog entries
acc capture --link
# Show more commit history for selection when linking
acc capture -n 50 --link
Sample Output
$ acc capture -n 5
Recent Git Commits:
─────────────────────────────────────────────────────────────────
f4a2b1c 2025-01-16 14:30 Fix authentication bug in login flow
Files: src/auth/jwt.js, src/middleware/auth.js
e8d5c9a 2025-01-16 13:15 Add user profile endpoint to API
Files: src/routes/users.js, src/controllers/userController.js
b7c3f2e 2025-01-16 11:45 Update dashboard styling for mobile
Files: src/components/Dashboard.jsx, src/styles/dashboard.css
d9e1a4f 2025-01-16 10:20 Implement password reset functionality
Files: src/auth/password.js, src/templates/reset-email.html
c5b8e7d 2025-01-16 09:30 Add validation for user registration
Files: src/validation/user.js, src/routes/auth.js
Use 'acc capture --edit' to create a work log entry from these commits.
Editor Integration
When using --edit
, the CLI opens your default editor with:
# Work Log Entry from Git Commits
# Edit this content to create your work log entry
# Lines starting with # are comments and will be ignored
Recent development work:
- Fix authentication bug in login flow
- Add user profile endpoint to API
- Update dashboard styling for mobile
- Implement password reset functionality
- Add validation for user registration
# Commits processed:
# f4a2b1c Fix authentication bug in login flow
# e8d5c9a Add user profile endpoint to API
# b7c3f2e Update dashboard styling for mobile
# d9e1a4f Implement password reset functionality
# c5b8e7d Add validation for user registration
# Tags: (comma-separated, e.g., backend,frontend,bugfix)
# Project: (3-letter identifier, optional)
Link Mode vs Create Mode
Create Mode (Default)
When you run acc capture
without the --link
flag, the command will:
- Let you select commits to capture
- Create commits in the backend
- Prompt to create a new worklog entry and associate the commits with it
Link Mode (--link
flag)
When you run acc capture --link
, the command will:
- Let you select commits to capture
- Create commits in the backend
- Let you select from existing worklog entries to link the commits to
- Associate the selected commits with the chosen existing entries
Important: The --link
flag cannot be used with --edit
since it's for linking to existing entries, not creating new ones.
Workflow Integration
Daily Development Cycle
# Morning: start development
git pull
acc init # ensure project is configured
# Throughout the day: normal git workflow
git add .
git commit -m "Implement user authentication"
git commit -m "Add password validation"
git commit -m "Fix login redirect issue"
# End of day: capture work for logging
acc capture --edit
# Review and refine the generated entry, then save
Weekly Review
# Review week's commits
acc capture -n 50
# Create summary entry for the week
acc capture -n 20 --edit
Retrospective Linking
# Link older commits to existing entries you created manually
acc capture -n 100 --link
# Link recent bug fixes to existing bug report entries
acc capture -n 15 --link
Git Repository Requirements
- Must be run from within a git repository
- Repository must have at least one commit
- Reads from the current branch's history
Commit Information Displayed
For each commit, the output shows:
- Hash: Short commit SHA
- Timestamp: When the commit was made
- Message: Commit message (first line)
- Files: Modified files (if available)
Best Practices
Meaningful Commit Messages
Good commit messages make better work log entries:
# Good - descriptive and actionable
git commit -m "Fix authentication timeout bug in Safari"
git commit -m "Add user search functionality to admin panel"
# Less useful - too generic
git commit -m "fix bug"
git commit -m "update code"
Regular Capture
# Capture daily work
acc capture --edit
# Focus on recent commits for current session
acc capture -n 5 --edit
Tag Commits by Type
Use consistent patterns in commit messages:
git commit -m "feat: add user dashboard"
git commit -m "fix: resolve payment processing error"
git commit -m "docs: update API documentation"
Editor Configuration
Set your preferred editor:
export EDITOR="code" # VS Code
export EDITOR="vim" # Vim
export EDITOR="nano" # Nano
Integration with Other Commands
# Capture commits and immediately view logs
acc capture --edit && acc logs -n 5
# Link commits to existing entries and view updated logs
acc capture --link && acc logs -n 5
# Review today's work
acc capture -n 10
acc logs --from $(date +%Y-%m-%d)
Requirements
- Must be run from within a git repository
- Must be authenticated (
acc login
) if using--edit
or--link
- Git must be installed and accessible
- For
--link
mode: existing worklog entries must exist in the project
Notes
- Only reads local git history (doesn't fetch from remote)
- Respects git repository boundaries
- Commit information is read-only; no git operations are performed
- Editor template can be customized based on commit patterns