https://github.com/ararslan/git-file-history
Get the full, patchable commit history for a single file
https://github.com/ararslan/git-file-history
git git-addons
Last synced: 7 months ago
JSON representation
Get the full, patchable commit history for a single file
- Host: GitHub
- URL: https://github.com/ararslan/git-file-history
- Owner: ararslan
- License: bsd-2-clause
- Created: 2016-12-20T06:47:39.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-01T22:38:17.000Z (over 6 years ago)
- Last Synced: 2025-03-16T16:40:54.106Z (7 months ago)
- Topics: git, git-addons
- Language: Shell
- Size: 2.93 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git file-history
This script provides a Git subcommand to retrieve commit history for a particular file
in a repository.
This is particularly useful for preserving the commit history of a file when moving it
to another repository.
To generate a patch file, pipe the output to a .patch file.
Otherwise the output is displayed using Git's default pager.## Installation
Put the `git-file-history` file anywhere in your path.
That's it!## Example
Say you have a repository of recipes and you want to move the section for greens to its
own separate repository, while preserving full authorship information.```bash
cd ~/recipes
git file-history greens/salad.txt > ~/salad.patch
mkdir ~/leafy-recipes && cd ~/leafy-recipes
git init
git am --committer-date-is-author-date < ~/salad.patch
```