mirror of
https://github.com/k88hudson/git-flight-rules.git
synced 2025-03-10 12:48:43 -03:00
Issue #194 - Snippet to list changes (diff) of a specific file between two commits (or branches)
This commit is contained in:
parent
4f3582494d
commit
0f16ad1e2d
16
README.md
16
README.md
@ -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 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 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 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)
|
- [Configuration](#configuration)
|
||||||
- [I want to add aliases for some Git commands](#i-want-to-add-aliases-for-some-git-commands)
|
- [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)
|
- [I want to add an empty directory to my repository](#i-want-to-add-an-empty-directory-to-my-repository)
|
||||||
@ -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
|
(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
|
## Configuration
|
||||||
|
|
||||||
### I want to add aliases for some Git commands
|
### I want to add aliases for some Git commands
|
||||||
|
Loading…
x
Reference in New Issue
Block a user