Skip to content

Commit

Permalink
Issue k88hudson#194 - Snippet to list changes (diff) of a specific fi…
Browse files Browse the repository at this point in the history
…le between two commits (or branches)
  • Loading branch information
fhavrlent authored and RichardLitt committed May 14, 2018
1 parent 4328207 commit 95cee78
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -101,6 +101,7 @@ For clarity's sake all examples in this document use a customized bash prompt in
- [I want to overwrite local files when doing a git pull](#i-want-to-overwrite-local-files-when-doing-a-git-pull)
- [I want to remove a file from Git but keep the file](#i-want-to-remove-a-file-from-git-but-keep-the-file)
- [I want to revert a file to a specific revision](#i-want-to-revert-a-file-to-a-specific-revision)
- [I want to list changes of a specific file between commits or branches](#i-want-to-list-changes-of-a-specific-file-between-commits-or-branches)
- [Configuration](#configuration)
- [I want to add aliases for some Git commands](#i-want-to-add-aliases-for-some-git-commands)
- [I want to add an empty directory to my repository](#i-want-to-add-an-empty-directory-to-my-repository)
Expand Down Expand Up @@ -1344,6 +1345,21 @@ If you want to revert to changes made just 1 commit before c5f567, pass the comm
(master)$ git checkout c5f567~1 -- file1/to/restore file2/to/restore
```

<a href="i-want-to-list-changes-of-a-specific-file-between-commits-or-branches"></a>
### I want to list changes of a specific file between commits or branches

Assuming you want to compare last commit with file from commit c5f567:

```sh
$ git diff HEAD:path_to_file/file c5f567:path_to_file/file
```

Same goes for branches:

```sh
$ git diff master:path_to_file/file staging:path_to_file/file
```

## Configuration

### I want to add aliases for some Git commands
Expand Down

0 comments on commit 95cee78

Please sign in to comment.