Skip to content

synchronal/dyd

Repository files navigation

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

via homebrew:

brew tap synchronal/tap
brew install dyd

via cargo:

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"
difftool = "git"     # Uses the configured default GUI difftool.
difftool = "github"  # Uses the `open` command to open a diff in the GitHub site.
difftool = "git difftool --dir-diff --tool=intellij -y ${DIFF}" # Arbitrary commands may be set.

[remotes]

[remotes.dyd]
name = "DYD"
origin = "[email protected]:synchronal/dyd"

[remotes.tui]
name = "TUI"
origin = "[email protected]:fdehau/tui-rs"

[remotes.tui]
name = "TUI"
origin = "[email protected]: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.
      • DYD_PWD - the working directory that dyd was run from.
      • ORIGIN - the origin used to check out the repository, ie [email protected]:<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.
    • name - Text to show in the UI.
    • origin - The git origin from which to pull.
    • branch - An optional branch to show diffs from. Depends on being able to view logs via origin/{branch}.

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
DYD_MANIFEST_PATH="dyd.toml" dyd diff

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

GitHub (browser)

When all repos in a manifest have their origins in GitHub, dyd can be configured to open diffs in the system's default browser.

Add to your dyd.toml manifest file:

difftool = "github"

IntelliJ IDEA

(You can download IntelliJ IDEA Community Edition for free, which has a pretty good graphical difftool.)

Add to your ~/.gitconfig file:

[diff]
    tool = intellij
    guitool = intellij
[difftool "intellij"]
    cmd = open -nWa 'IntelliJ IDEA CE.app' --args diff $(realpath "$LOCAL") $(realpath "$REMOTE")
[difftool]
    prompt=false

Add to your dyd.toml manifest file:

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

Others

  • gitx
  • kdiff3
  • ???

References