(git) log for file/directory
This commit is contained in:
@@ -12,14 +12,19 @@ findings.
|
|||||||
- [glossary](#glossary)
|
- [glossary](#glossary)
|
||||||
- [branches](#branches)
|
- [branches](#branches)
|
||||||
- [create a branch](#create-a-branch)
|
- [create a branch](#create-a-branch)
|
||||||
|
- [delete a branch](#delete-a-branch)
|
||||||
- [submodules](#submodules)
|
- [submodules](#submodules)
|
||||||
|
- [update reference](#update-reference)
|
||||||
|
- [show only names of changed files on `show` or `diff`](#show-only-names-of-changed-files-on-show-or-diff)
|
||||||
- [stash](#stash)
|
- [stash](#stash)
|
||||||
- [fixup](#fixup)
|
- [fixup](#fixup)
|
||||||
- [removing files from the index](#removing-files-from-the-index)
|
- [removing files from the index](#removing-files-from-the-index)
|
||||||
|
- [list commits that changed a file or directory](#list-commits-that-changed-a-file-or-directory)
|
||||||
- [philosophies](#philosophies)
|
- [philosophies](#philosophies)
|
||||||
- [merge](#merge)
|
- [merge](#merge)
|
||||||
- [rebase](#rebase)
|
- [rebase](#rebase)
|
||||||
- [squash](#squash)
|
- [squash](#squash)
|
||||||
|
- [tags](#tags)
|
||||||
<!--toc:end-->
|
<!--toc:end-->
|
||||||
|
|
||||||
|
|
||||||
@@ -128,6 +133,26 @@ git rm --cached <file-name>
|
|||||||
This is helpful if one accidentally committed autogenerated files.
|
This is helpful if one accidentally committed autogenerated files.
|
||||||
|
|
||||||
|
|
||||||
|
## log for file or directory
|
||||||
|
|
||||||
|
To show the commits that changed a file use
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git log --follow <filename>
|
||||||
|
```
|
||||||
|
|
||||||
|
For a directory use
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git log <path>
|
||||||
|
```
|
||||||
|
|
||||||
|
The latter struggles when a files was renamed, so for specific files
|
||||||
|
it is recommended to use the first command.
|
||||||
|
For directories, or when sure that the file was not renamed, the
|
||||||
|
second command is easier.
|
||||||
|
|
||||||
|
|
||||||
## philosophies
|
## philosophies
|
||||||
|
|
||||||
Important things to always remember:
|
Important things to always remember:
|
||||||
|
|||||||
Reference in New Issue
Block a user