The [diff] Command

Show different between files

Usage

libra diff [OPTIONS] [PATHSPEC]...

Arguments

  • [PATHSPEC] - File or directory name with a path relative to current directory or a absolute path

Description

Show changes between the working tree and the index or a tree, changes between the index and a tree, changes between two trees.

If no arguments are given, the changes between the working tree and the index are shown. If the index don't have any changes, the changes between the working tree and the HEAD are shown.

PATHSPEC can be a file or directory name with a path relative to current directory or a absolute path. (The git support relative path start from the repository root, which is not supported in libra yet.). Because what's you are diff may not in disk currently, libra didn't check if the path exists.

Note:

The diff command use less to show the result in unix-like system, and simply print all the content in windows. If you are using unix-like system, you need to ensure less is installed (usually it is installed by default).

Options

Options:

  • --old <COMMIT> Old branch/commit, defaults is staged or HEAD
  • --new <COMMIT> New branch/commit, default is working directory
  • --staged Use stage as new commit. This option is conflict with --new.
  • --output <FILENAME> Print the result to a file
  • -h, --help Print help

Note:

Because of the clap's limitation, the diff command's options are different from git's diff command.