Skip to main content
Documentation

Commits & History

Commits are snapshots of your project at a point in time. They form a chain of history that lets you track changes, compare versions, and restore previous states.

What is a Commit?

A commit in Dits records:

  • Tree: A snapshot of all files at that moment
  • Parents: Reference(s) to previous commit(s)
  • Author: Who created the changes
  • Committer: Who recorded the commit
  • Timestamp: When the commit was created
  • Message: Description of what changed
Commit a1b2c3d4
├── Tree: def456...
│   ├── footage/scene1.mov → asset:789abc...
│   ├── footage/scene2.mov → asset:012def...
│   └── project.prproj     → asset:345ghi...
├── Parent: 9f8e7d6c
├── Author: Jane Editor <jane@example.com>
├── Date: 2024-01-15 10:30:00 -0800
└── Message: Add color grading to scene 1

Creating Commits

Stage your changes with dits add, then create a commit:

# Stage specific files
$ dits add footage/scene1.mov

# Stage all changes
$ dits add .

# Create the commit
$ dits commit -m "Add scene 1 footage"

[main a1b2c3d] Add scene 1 footage
 1 file changed, 10 GB added

Interactive Staging

For fine-grained control, use interactive mode:

$ dits add -i

*** Commands ***
  1: status     2: add       3: revert
  4: diff       5: quit

What now> 2
  1: footage/scene1.mov (modified)
  2: footage/scene2.mov (new file)

Add>> 1
Staged footage/scene1.mov

Commit Messages

Good commit messages help you and your team understand what changed and why.

# Short message
$ dits commit -m "Add scene 1 color grading"

# Multi-line message (opens editor)
$ dits commit

# Message with body
$ dits commit -m "Add scene 1 color grading

- Applied LUT: Kodak 2383
- Adjusted shadows +10
- Fixed skin tone in shots 5-8"

Viewing History

dits log
View commit history with messages, authors, and dates.
dits show
View details of a specific commit including what files changed.
dits diff
Compare commits to see exactly what changed between versions.

Basic Log

$ dits log

commit a1b2c3d4 (HEAD -> main)
Author: Jane Editor <jane@example.com>
Date:   Mon Jan 15 10:30:00 2024 -0800

    Add color grading to scene 1

commit 9f8e7d6c
Author: John Editor <john@example.com>
Date:   Sun Jan 14 16:45:00 2024 -0800

    Initial footage import

Formatted Log

# One-line format
$ dits log --oneline
a1b2c3d Add color grading to scene 1
9f8e7d6 Initial footage import
5c4b3a2 Initialize project

# Graph view (shows branches)
$ dits log --graph --oneline
* a1b2c3d (HEAD -> main) Add color grading
| * f5e4d3c (feature/audio) Add sound effects
|/
* 9f8e7d6 Initial footage import

# Show file stats
$ dits log --stat
commit a1b2c3d
    Add color grading to scene 1
 footage/scene1.mov | 10.2 GB → 10.2 GB (modified)
 1 file changed

Inspecting Commits

Show Commit Details

$ dits show a1b2c3d

commit a1b2c3d4
Author: Jane Editor <jane@example.com>
Date:   Mon Jan 15 10:30:00 2024 -0800

    Add color grading to scene 1

Changed files:
 M footage/scene1.mov
   Chunks: 10,234 total, 156 changed (1.5%)
   Size:   10.2 GB (unchanged)

Show File at Commit

# View file list at a commit
$ dits show a1b2c3d --name-only

footage/scene1.mov
footage/scene2.mov
project.prproj

# Export a file from a specific commit
$ dits show a1b2c3d:footage/scene1.mov > old_scene1.mov

Comparing Commits

Diff Between Commits

# Compare two commits
$ dits diff 9f8e7d6 a1b2c3d

Changed: footage/scene1.mov
  Chunks modified: 156 of 10,234 (1.5%)
  Size: 10.2 GB → 10.2 GB

# Compare with working directory
$ dits diff HEAD

# Compare specific file
$ dits diff 9f8e7d6 a1b2c3d -- footage/scene1.mov

Video-Aware Diff

For video files, Dits can show time-based differences:

$ dits diff --video-aware a1b2c3d HEAD -- scene1.mov

footage/scene1.mov:
  Duration: 5:00.00 (unchanged)
  Changed segments:
    00:45.00 - 01:12.00 (color grading applied)
    03:22.00 - 03:45.00 (color grading applied)

Commit References

You can reference commits in various ways:

# Full hash
a1b2c3d4e5f6789...

# Short hash (first 7+ characters)
a1b2c3d

# Branch name (latest commit on branch)
main

# HEAD (current commit)
HEAD

# Relative references
HEAD~1    # Parent of HEAD
HEAD~2    # Grandparent of HEAD
HEAD^     # First parent (same as HEAD~1)
HEAD^2    # Second parent (for merge commits)

# By date
main@{yesterday}
main@{2024-01-15}

Amending Commits

Fix the most recent commit without creating a new one:

# Add forgotten files and amend
$ dits add forgotten_file.mov
$ dits commit --amend

# Just fix the message
$ dits commit --amend -m "Better commit message"

Undoing Commits

Revert (Safe)

Create a new commit that undoes changes from a previous commit:

$ dits revert a1b2c3d

Reverting "Add color grading to scene 1"
[main b2c3d4e] Revert "Add color grading to scene 1"

Reset (Careful)

Move the branch pointer to a different commit:

# Keep changes in working directory
$ dits reset --soft HEAD~1

# Keep changes unstaged
$ dits reset --mixed HEAD~1

# Discard all changes (dangerous!)
$ dits reset --hard HEAD~1

Next Steps