Domanda

I don't know if Git has the concept of a revision.

I'd like to diff the current working copy with an older version of it (not necessarily the last commit).

It would be great if it could be done inside Emacs.

È stato utile?

Soluzione

I've no idea about doing this inside Emacs, but:

git diff rev1..rev2

will do what you want for the whole repository. You can then add to that:

 git diff rev1>..rev2 path

path can be an absolute path to a file, or a path to a directory, so you can diff subtrees.

If you're looking to diff the working copy - just specify revision 1:

git diff rev1 path

The revision codes can be special names, for example, HEAD^..HEAD means last to current, or their SHA-1 values from the logs.

Altri suggerimenti

To do this in Emacs (using magit) you can:

  1. From a magit buffer press d to open up the diff menu
  2. Press r to select the range of commits to use in the diff. Alternatively, you can highlight a range of commits and they will automatically be selected.

If you only want to diff certain files, you can also use the -- option to select which files will be included in the diff.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top