Comments (14)
I've got this working with git diff
, but not git add --patch
. Any ideas how to make this work ubiquitously?
from icdiff.
After reading your post, I wanted to make a try with Mercurial.
As explain here: http://mercurial.selenic.com/wiki/ExtdiffExtension
It's sufficient to add the following in the file ~/.hgrc
[extensions]
hgext.extdiff=
[extdiff]
cmd.diff=icdiff
Seems working just fine :-).
from icdiff.
I don't really like changing the default diff tool, so I would like to use an alias instead, like git icdiff
.
So far I got GIT_EXTERNAL_DIFF='sh -c "icdiff \"$2\" \"$5\""' git diff
working, but I don't know how to turn it into a git alias.
from icdiff.
I got it configured as my difftool (git difftool --help
) with the following configuration in ~/.gitconfig
:
[diff]
tool = icdiff
[difftool "icdiff"]
cmd = icdiff $LOCAL $REMOTE
It preserves the default behavior of git diff
but aliasing git difftool
to gd
works just fine 👍
from icdiff.
@desyncr you might want to quote that: cmd = icdiff "$LOCAL" "$REMOTE"
from icdiff.
@desyncr
That does not use a pager, does it? Setting pager.difftool = true
does that, but then it fails miserable with the vimdiff
difftool.
I've also tried passing it the --no-bold
option (I am using the Solarized colorscheme, where this is recommended), but that also fails:
[difftool "icdiff"]
cmd = git-icdiff --no-bold "$LOCAL" "$REMOTE"
+ git difftool --no-prompt --extcmd icdiff --no-bold+ /tmp/VbQI5y_pyenv.vim autoload/pyenv.vim
less --no-init --quit-if-one-screen
fatal: invalid diff option/value: --no-bold
Using it via `git-icdiff` does not display the colors, but Escape codes (this is caused by `LESS_IS_MORE=1`), and fails after quitting `less` before everything has been read:
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
Instead of LESS_IS_MORE, less' -F or --quit-if-one-screen
option should be used - or just do not set/change it altogether, using the user's config (via Git's core.pager and the $LESS
environment variable).
I think I'll be sticking to vimdiff
for Git, but having icdiff
in general is nice!
from icdiff.
@k4nar:
To create any git <anything>
command you just need to create an executable inside /usr/lib/git-core/
directory (or similar in your system):
$ cat /usr/lib/git-core/git-icdiff
#!/bin/bash
git difftool
Then I can execute git icdiff
and git difftool
is executed. In order for this to work with icdiff
you need to configure your git difftool
appropriately:
$ cat ~/.gitconfig
[diff]
tool = icdiff
[difftool]
prompt = false
[difftool "icdiff"]
cmd = icdiff $LOCAL $REMOTE
Remember to chmod u+x
your script. If you don't know where to put your script execute locate git-config
and the path where git-config
file is located is the one you're looking for.
Obviously more advanced things can be implemented.
from icdiff.
Regarding the original approach it can be reduced to:
$ cat /usr/local/bin/ext-diff
#!/bin/bash
icdiff $2 $5
With the following git configuration:
[diff]
external = ext-diff
[core]
pager =
Hope that helps.
from icdiff.
@desyncr : Thanks, I'll try that !
from icdiff.
As of today, after installing it via brew, I aliased the wrapper coming with icdiff version 1.7.2
:
alias gdi="$(brew --prefix icdiff)/bin/git-icdiff $GIT_DIFF_OPTIONS"
and it works fine, compared against the analogous:
git diff $GIT_DIFF_OPTIONS
from icdiff.
To get the file labels correctly, plus other personally cool features, I have now in my .gitconfig
:
[pager]
difftool = true
[diff]
tool = icdiff
[difftool "icdiff"]
cmd = icdiff --head=5000 --highlight --line-numbers -L \"$BASE\" -L \"$REMOTE\" \"$LOCAL\" \"$REMOTE\"
And I use it like: git difftool
from icdiff.
@JoseAlban What do the first four lines do? Can they be used independently of the last two lines?
Edit: Should have read the documentation first, it's all explained very clearly. Here are the relevant lines from git-config(1)
:
diff.tool
Controls which diff tool is used by git-difftool(1). This variable overrides
the value configured in merge.tool. The list below shows the valid built-in
values. Any other value is treated as a custom diff tool and requires that a
corresponding difftool.<tool>.cmd variable is defined.
...
difftool.<tool>.cmd
Specify the command to invoke the specified diff tool. The specified command is
evaluated in shell with the following variables available: LOCAL is set to the
name of the temporary file containing the contents of the diff pre-image and
REMOTE is set to the name of the temporary file containing the contents of the
diff post-image.
...
pager.<cmd>
If the value is boolean, turns on or off pagination of the output of a
particular Git subcommand when writing to a tty. Otherwise, turns on pagination
for the subcommand using the pager specified by the value of pager.<cmd>. If
--paginate or --no-pager is specified on the command line, it takes precedence
over this option. To disable pagination for all commands, set core.pager or
GIT_PAGER to cat.
For the record, I also went ahead and set difftool.prompt = false
, like others have mentioned:
difftool.prompt
Prompt before each invocation of the diff tool.
from icdiff.
@jez exactly! I just couldn't tie it together nicely with git show
:( but it has by itself an inline diff (surprisingly), which is what I use (although I wish I could do icdiff
still):
git show --word-diff
from icdiff.
git-icdiff is now part of the default install (and has been for a while)
from icdiff.
Related Issues (20)
- Apt package? HOT 2
- update icdiff on pypi.org to latest version HOT 2
- ChangeLog does not mention versions newer than 1.9.4 HOT 1
- BUG: Filenames show as mismatch when using exclusions
- Bug report: configuration for `git icdiff` did not work HOT 2
- installing the latest release-2.0.0 requires different command than install instructions HOT 2
- icdiff doesn't work on windows HOT 2
- Add support to specify colors using RGB ? HOT 1
- Add Support for custom patch hunk headers (with some builtins) HOT 1
- It seems have some problem about utf-8 HOT 1
- git icdiff shows old filname for renamed files HOT 2
- Multi-version of the Python HOT 1
- Exit code 1 using process substitutions HOT 4
- Pip install with `--platform` showing ERROR HOT 2
- [issue] linux more shows empty line. ex) icdiff -N fileA fileB | more -60 HOT 1
- Config file HOT 1
- Feature Request: Add an option to output directories before the files (recursively) HOT 1
- icdiff hanging on large files HOT 5
- Not clear how to install icdiff HOT 2
- Publish wheels for icdiff HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icdiff.