-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit create: Add --fixup flag (#500)
Adds a new --fixup flag for allowing you to create fixup commits. --fixup takes a commitish which targets where the fixup will be applied. --fixup also takes the search :/<text> to target the subject of a commit message to target the correct commit. Using gs branch edit with the autosquash option set in git allows us to automatically fixup our commits. Resolves #492
- Loading branch information
1 parent
285a611
commit 1731f3e
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kind: Added | ||
body: 'commit create: Added a --fixup flag to allow adding a fixup commit.' | ||
time: 2024-11-27T12:59:53.626214-08:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Commit create usage with --fixup option. | ||
|
||
as 'Test <[email protected]>' | ||
at '2024-03-30T14:59:32Z' | ||
|
||
# setup | ||
cd repo | ||
git init | ||
git commit --allow-empty -m 'Initial commit' | ||
gs repo init | ||
|
||
git checkout -b feature | ||
gs branch track --base main | ||
|
||
# create a couple commits | ||
git add foo.txt | ||
gs cc -m 'Add foo' | ||
mv $WORK/extra/bar.txt bar.txt | ||
git add bar.txt | ||
gs cc -m 'Add bar' | ||
mv $WORK/extra/new_foo.txt foo.txt | ||
gs cc -a --fixup :/foo | ||
|
||
# verify the output | ||
git log | ||
cmp stdout $WORK/golden/log.1.txt | ||
|
||
-- repo/foo.txt -- | ||
Contents of foo. | ||
|
||
-- extra/new_foo.txt -- | ||
New contents of foo. | ||
|
||
-- extra/bar.txt -- | ||
Contents of bar.txt | ||
|
||
-- golden/log.1.txt -- | ||
commit 09309bfe664697b2e69d883ccd6ab7cbef505d0d | ||
Author: Test <[email protected]> | ||
Date: Sat Mar 30 14:59:32 2024 +0000 | ||
|
||
fixup! Add foo | ||
|
||
commit 6295ed5efe1d126f9b26c33d699b971e15589a0b | ||
Author: Test <[email protected]> | ||
Date: Sat Mar 30 14:59:32 2024 +0000 | ||
|
||
Add bar | ||
|
||
commit 91582344149997d5a513acf7b4d56a03452e23cd | ||
Author: Test <[email protected]> | ||
Date: Sat Mar 30 14:59:32 2024 +0000 | ||
|
||
Add foo | ||
|
||
commit 9bad92b764fe1d56cb99b394f373a71cdefd8e86 | ||
Author: Test <[email protected]> | ||
Date: Sat Mar 30 14:59:32 2024 +0000 | ||
|
||
Initial commit |