https://github.com/nudin/git-split
split an arbitrary commit
https://github.com/nudin/git-split
git rebase
Last synced: 2 months ago
JSON representation
split an arbitrary commit
- Host: GitHub
- URL: https://github.com/nudin/git-split
- Owner: Nudin
- License: mpl-2.0
- Created: 2021-04-04T14:30:32.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-04T19:53:15.000Z (about 4 years ago)
- Last Synced: 2025-01-05T15:43:39.696Z (4 months ago)
- Topics: git, rebase
- Language: Shell
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
git-split – split an arbitrary commit
=====================================Use case: You want to clean up your git history before pushing it and notice that one commit contains to many (unrelated) changes.
Installation:
Put into a directory in you PATH, for example:
```
cp git-split.sh ~/bin/git-split
chmod +x ~/bin/git-split
```Usage:
```
git split [-p] [--auto-stash]-p Split patch wise instead of file wise
--auto-stash Stash and unstash changes in the current working tree
```Example:
Split the commit `abc1234` into multiple commits, so that each commit edits only one file:
```
$ git log --oneline --stat
3ec599e (HEAD -> main) weiter3
[...]
abc1234 file3~2: Huge commit
file1 | 2 +-
file2 | 2 +-
file3 | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
9d3b901 Init
[...]$ git split abc1234
$ git log --oneline
3ec599e (HEAD -> main) weiter3
[...]
ad5687a file3: Huge commit
file3 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
55d5d31 file2: Huge commit
file2 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
c27e7a1 file1: Huge commit
file1 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
9d3b901 Init
[...]
```