Skip to main content
Documentation

File Commands

Commands for adding, removing, and managing files in your Dits repository.

CommandDescriptionUsage
addAdd files to staging areadits add <pathspec>...
rmRemove files from trackingdits rm <file>...
mvMove or rename filesdits mv <source> <dest>
restoreRestore working tree filesdits restore <pathspec>...
commitRecord changes to repositorydits commit -m <message>
stashTemporarily save changesdits stash [push | pop | list]

dits add

Add file contents to the staging area. This chunks the files using content-defined chunking and prepares them for the next commit. For video files, Dits uses format-aware chunking that aligns to keyframes for optimal deduplication.

Synopsis

dits add [options] &lt;pathspec&gt;...

Options

--all, -A        Add all changes (new, modified, deleted)
--update, -u     Update tracked files only (no new files)
--force, -f      Allow adding ignored files
--dry-run, -n    Show what would be added
--interactive    Interactive staging mode
--patch, -p      Interactively select portions to add
--verbose, -v    Be verbose about added files

Examples

# Add specific file
$ dits add footage/scene1.mov
Chunking footage/scene1.mov... 10,234 chunks (10.2 GB)

# Add all files in directory
$ dits add footage/
Chunking 5 files... done
  footage/scene1.mov    10,234 chunks
  footage/scene2.mov     8,456 chunks
  footage/scene3.mov    12,789 chunks
  footage/b-roll-1.mov   3,456 chunks
  footage/b-roll-2.mov   2,345 chunks
Total: 37,280 chunks (36.5 GB)

# Add all changes
$ dits add -A

# See what would be added
$ dits add --dry-run footage/
Would add 'footage/scene1.mov'
Would add 'footage/scene2.mov'

# Add with verbose output
$ dits add -v project.prproj
add 'project.prproj' (1,234 chunks, 1.2 MB)

dits rm

Remove files from the working tree and staging area. The chunks remain in the object store until garbage collection, preserving history.

Synopsis

dits rm [options] &lt;file&gt;...

Options

--cached         Only remove from staging, keep in working dir
--force, -f      Override up-to-date check
--recursive, -r  Remove directories recursively
--dry-run, -n    Show what would be removed

Examples

# Remove a file
$ dits rm footage/unused-take.mov
rm 'footage/unused-take.mov'

# Remove from tracking but keep file
$ dits rm --cached renders/output.mp4
Stopped tracking 'renders/output.mp4'
(file still exists in working directory)

# Remove directory
$ dits rm -r old-footage/
rm 'old-footage/scene1.mov'
rm 'old-footage/scene2.mov'

# Preview removal
$ dits rm --dry-run footage/test-*.mov
Would remove 'footage/test-1.mov'
Would remove 'footage/test-2.mov'

dits mv

Move or rename a file, directory, or symlink. Since Dits uses content- addressing, renames are instant regardless of file size.

Synopsis

dits mv [options] &lt;source&gt; &lt;destination&gt;

Options

--force, -f      Force rename even if target exists
--dry-run, -n    Show what would happen
--verbose, -v    Report renamed files

Examples

# Rename a file
$ dits mv footage/scene1.mov footage/scene1-final.mov
Renamed 'footage/scene1.mov' -> 'footage/scene1-final.mov'

# Move to different directory
$ dits mv footage/scene1.mov archive/
Moved 'footage/scene1.mov' -> 'archive/scene1.mov'

# Rename directory
$ dits mv raw-footage/ source-footage/
Renamed 'raw-footage/' -> 'source-footage/'

dits restore

Restore working tree files from the index or a specific commit. This reconstructs files from stored chunks, allowing you to discard changes or retrieve previous versions.

Synopsis

dits restore [options] &lt;pathspec&gt;...

Options

--source, -s     Restore from specified commit
--staged, -S     Restore staged changes (unstage)
--worktree, -W   Restore working tree (discard changes)
--ours           Use our version (during merge)
--theirs         Use their version (during merge)

Examples

# Discard changes to a file
$ dits restore footage/scene1.mov
Restored 'footage/scene1.mov'

# Unstage a file (keep changes)
$ dits restore --staged footage/scene1.mov
Unstaged 'footage/scene1.mov'

# Restore from a specific commit
$ dits restore -s HEAD~2 footage/scene1.mov
Restored 'footage/scene1.mov' from a1b2c3d

# Restore entire directory
$ dits restore footage/
Restored 5 files

# Discard all changes
$ dits restore .

dits commit

Record changes to the repository by creating a new commit object. Commits contain a tree hash pointing to the complete state, parent commit(s), author/committer information, and a message.

Synopsis

dits commit [options]

Options

--message, -m    Commit message
--all, -a        Automatically stage modified files
--amend          Amend the previous commit
--no-edit        Use previous commit's message (with --amend)
--author         Override author
--date           Override date
--allow-empty    Allow empty commit
--dry-run        Show what would be committed

Examples

# Basic commit
$ dits commit -m "Add scene 1 color grading"
[main a1b2c3d] Add scene 1 color grading
 1 file changed, 10.2 GB modified

# Commit with detailed message
$ dits commit -m "Add scene 1 color grading

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

# Stage and commit all changes
$ dits commit -a -m "Update all footage"

# Amend last commit
$ dits commit --amend -m "Better commit message"

# See what would be committed
$ dits commit --dry-run
Changes to be committed:
  modified: footage/scene1.mov
  new file: footage/scene4.mov

dits stash

Temporarily save changes without committing. Useful when you need to switch branches but have uncommitted work. Stashed changes are stored efficiently using the same chunk deduplication as commits.

Synopsis

dits stash [push [-m <message>]]
dits stash list
dits stash show [stash]
dits stash pop [stash]
dits stash drop [stash]

Examples

# Stash current changes
$ dits stash
Saved working directory state WIP on main: a1b2c3d Add scene 1

# Stash with message
$ dits stash push -m "WIP: color grading experiment"
Saved working directory state: WIP: color grading experiment

# List stashes
$ dits stash list
stash@{0}: WIP: color grading experiment
stash@{1}: WIP on main: a1b2c3d Add scene 1

# Apply and remove stash
$ dits stash pop
Restored 'footage/scene1.mov'
Dropped stash@{0}

# Apply without removing
$ dits stash apply stash@{1}

# Remove a stash
$ dits stash drop stash@{0}

Related Commands