Gentoo Archives: gentoo-user

From: Ian Zimmerman <itz@××××××××××××.org>
To: gentoo-user@l.g.o
Subject: [gentoo-user] OT: git, how to compare a repo with a loose tree
Date: Fri, 08 Dec 2017 02:58:44
Message-Id: 20171208025830.wsgp4fwkbhqhcnmv@matica.foolinux.mooo.com
1 I would like to use "git diff" to show differences between the
2 current state of a git repository and a normal directory tree somewhere
3 on the filesystem, ie. one without a .git subdirectory. This is proving
4 surprisingly hard to do.
5
6 git diff has a documented mode to compare general "paths" as they call
7 it: the --no-index option. But when I try it like this inside a git repo,
8
9 git diff --no-index . /somedir
10
11 git apparently "forgets" that the current directory is a repo, and just
12 basically apes diff -r. This means it doesn't know which files are
13 tracked, and in particular it reports every freaking file under ./.git
14 as deleted. And there is no exclude option that I see. Argh! How can
15 I get around this?
16
17 If it matters: I'm fine with assuming the repo is clean ie. no
18 uncommitted changes, so the current state can be represented as any of:
19 working tree, "index" or HEAD.
20
21 --
22 Please don't Cc: me privately on mailing lists and Usenet,
23 if you also post the followup to the list or newsgroup.
24 To reply privately _only_ on Usenet, fetch the TXT record for the domain.

Replies

Subject Author
Re: [gentoo-user] OT: git, how to compare a repo with a loose tree Michael Orlitzky <mjo@g.o>