I have a git directory and another separate directory where I extracted all the files, but not the .git directory
my question is:
how do I compare a specific commit of the git directory to the files in the extracted directory?
edit:
You can temporarily (for the duration of the git diff command itself only) override Git's notion of where the work-tree lives:
git --work-tree=<path-to-tree> diff <commit>
Or, equivalently, from that path:
git --git-dir=<path-to-.git-directory> diff <commit>
(which uses . as the work-tree path while obtaining commits from the given .git directory).
Use whichever is most convenient. This might even be to use both options. Specifically, with --git-dir=path, Git will assume that the current working directory is the top level of the work-tree unless you also specify --work-tree=top-of-work-tree. One or both paths may be relative to the current working directory.
(This all works with git diff-tree, git diff-index, and git diff-files as well, though it's probably most useful with git diff-tree for scripts and git diff for personal usage.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With