6 releases (breaking)

0.5.0 Aug 16, 2022
0.4.0 Aug 11, 2022
0.3.0 May 6, 2022
0.2.0 May 6, 2022
0.1.1 Apr 29, 2022

#1724 in Command line utilities

25 downloads per month

MIT license

53KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments Shell 164 SLoC // 0.0% comments

DYD

CI Hex pm License

Daily diff.

This command line tool facilitates the viewing of git diffs across multiple projects, across multiple days. See what you're doing across teams, and across all the git repos your teams manage.

Installation

cargo install dyd

Configure git with a GUI difftool:

[diff]
  tool = Kaleidoscope
  guitool = Kaleidoscope
[difftool]
  prompt = false
[difftool "Kaleidoscope"]
  cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[mergetool "Kaleidoscope"]
  cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
  trustExitCode = true

Usage

Create a manifest file at dyd.toml with the following format:

since = "3 days ago"
#       "  ^^^^ days | weeks | months

## difftool = "my diff tool"

[remotes]

[remotes.dyd]
name = "DYD"
origin = "git@github.com:synchronal/dyd"

[remotes.tui]
name = "TUI"
origin = "git@github.com:fdehau/tui-rs"
  • since - Must be in the format <N> <units> ago. Defaults to 1 week ago.
  • difftool - Optional command to run in order to open a diff. Defaults to git difftool -g -y ${DIFF}.
    • Variables that will be interpolated into the command, and also made available in the difftool ENV. IMPORTANT: variables will only be replaced if they are in the format ${VAR}, including braces.
      • DIFF - in the format @{u}..HEAD.
      • ORIGIN - the origin used to check out the repository, ie git@github.com:<org>/<repo>(.git)?
      • REF_FROM - the sha of the earlier commit of the diff.
      • REF_TO - the sha of the more recent commit of the diff. HEAD.
  • remotes - a list of remote repositories to clone and pull.

Ensure that your shell is authorized with the origin. DYD will not route input to the SSH agent.

ssh-add ~/.ssh/id_ed25519

Open the diff tool:

dyd -m dyd.toml
dyd --manifest dyd.toml

Keymap:

h l <left> <right> <tab> - switch panes
j k <up> <down> - change current selection
d - open git gui difftool
q <esc> - quit

Other difftools

IntelliJ IDEA:

[diff]
  guitool = intellij
[difftool "intellij"]
  cmd = /Applications/IntelliJ\\ IDEA\\ CE.app/Contents/MacOS/idea diff $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE")

Manifest:

difftool = "git difftool --dir-diff --tool=intellij -y ${DIFF}"

TODO:

  • gitx
  • kdiff3
  • ???

References

Dependencies

~6–12MB
~217K SLoC