Is there a git diff option to tell me the relative names of all files that have changed in a diff? -
i find myself wanting open files changed in commit. current solution this, in alias:
$editor $(git diff --name-only --relative <commit names>)
which works pretty well, when in subdirectory, doesn't open files changed outside of directory, because git diff --name-only --relative
outputs files changed in current directory, not whole repo. there flag can pass git diff
make include changed files in repo, --relative
?
git's own aliases allow specify shell commands defining alias leading exclamation point. these shell-command aliases execute repository root, can use them in conjunction command you're using defining alias in .gitconfig
:
[alias] review-diff = "!edit() { $editor $(git diff --name-only --relative \"$@\"); }; edit"
then can run git review-diff
anywhere in repository.
(note: i'm not sure when version difference is, newer versions of git seem allow skip function wrapper in alias, making simpler setup:)
[alias] review-diff = "!$editor $(git diff --name-only --relative \"$@\")"
Comments
Post a Comment