* [gentoo-user] OT: git, how to compare a repo with a loose tree
@ 2017-12-08 2:58 Ian Zimmerman
2017-12-08 3:17 ` Michael Orlitzky
0 siblings, 1 reply; 2+ messages in thread
From: Ian Zimmerman @ 2017-12-08 2:58 UTC (permalink / raw
To: gentoo-user
I would like to use "git diff" to show differences between the
current state of a git repository and a normal directory tree somewhere
on the filesystem, ie. one without a .git subdirectory. This is proving
surprisingly hard to do.
git diff has a documented mode to compare general "paths" as they call
it: the --no-index option. But when I try it like this inside a git repo,
git diff --no-index . /somedir
git apparently "forgets" that the current directory is a repo, and just
basically apes diff -r. This means it doesn't know which files are
tracked, and in particular it reports every freaking file under ./.git
as deleted. And there is no exclude option that I see. Argh! How can
I get around this?
If it matters: I'm fine with assuming the repo is clean ie. no
uncommitted changes, so the current state can be represented as any of:
working tree, "index" or HEAD.
--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [gentoo-user] OT: git, how to compare a repo with a loose tree
2017-12-08 2:58 [gentoo-user] OT: git, how to compare a repo with a loose tree Ian Zimmerman
@ 2017-12-08 3:17 ` Michael Orlitzky
0 siblings, 0 replies; 2+ messages in thread
From: Michael Orlitzky @ 2017-12-08 3:17 UTC (permalink / raw
To: gentoo-user
On 12/07/2017 09:58 PM, Ian Zimmerman wrote:
> I would like to use "git diff" to show differences between the
> current state of a git repository and a normal directory tree somewhere
> on the filesystem, ie. one without a .git subdirectory. This is proving
> surprisingly hard to do.
If "git diff" isn't important, I was able to fake something close but
not quite like it:
colordiff --recursive \
--suppress-common-lines \
--unified \
--exclude=.git \
--new-file \
<src> \
<dst> \
| most
That uses app-misc/colordiff to colorize the diff output, and
sys-apps/most as my pager.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-08 3:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-08 2:58 [gentoo-user] OT: git, how to compare a repo with a loose tree Ian Zimmerman
2017-12-08 3:17 ` Michael Orlitzky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox