|
2 | 2 |
|
3 | 3 | Quickly fix up an old commit using your currently-staged changes.
|
4 | 4 |
|
5 |
| -[](https://asciinema.org/a/SYKj4ztmMJ52cSmGxSF9hHjtl?autoplay=1&t=3) |
| 5 | + |
6 | 6 |
|
7 | 7 | ## Usage
|
8 | 8 |
|
9 | 9 | After installation, just run `git fixup` or `git squash` to perform the related
|
10 | 10 | actions.
|
11 | 11 |
|
12 |
| -Running `git fixup` will check if you have any staged changes (if not it will |
13 |
| -prompt you to stage all changes) and then present you with a list of commits |
14 |
| -from your current work point (HEAD) to HEAD's upstream. For example, if you are |
15 |
| -on `master` and its is `origin/master`, `git fixup` will show all commits |
16 |
| -between `master` and `origin/master`. In general this is just what you want, |
17 |
| -since you probably shouldn't be editing commits that other people are working |
18 |
| -off of. |
| 12 | +By default, `git fixup` checks for staged changes and offers to amend an old |
| 13 | +commit. |
| 14 | + |
| 15 | +Given a repo that looks like: |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +Running `git fixup` will allow you to edit an old commit: |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +The default behavior will check if your current HEAD commit has an `upstream` |
| 24 | +branch and show you only the commits between where you currently are and that |
| 25 | +commit. If there is no upstream for HEAD you will see the behavior above. |
| 26 | + |
| 27 | +If you're using a pull-request workflow (e.g. github) you will often have repos that look more like this: |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +You can set `GIT_INSTAFIX_UPSTREAM` to a branch name and `git fixup` will only |
| 32 | +show changes between HEAD and the merge-base: |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +In general this is just what you want, since you probably shouldn't be editing |
| 37 | +commits that other people are working off of. |
19 | 38 |
|
20 | 39 | After you select the commit to edit, `git fixup` will apply your staged changes
|
21 | 40 | to that commit without any further prompting or work from you.
|
|
0 commit comments