-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
branch create: --[no-]commit flag, branchCreate.commit option (#347)
The flag defaults to `--commit`. Users can use `--no-commit` on a one-off basis to create a branch without committing changes. Alternatively, users can set `spice.branchCreate.commit` to `false` to make `--no-commit` the default behavior. They may then use `--commit` on a one-off basis to commit changes. Resolves #332
- Loading branch information
Showing
7 changed files
with
195 additions
and
44 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,6 @@ | ||
kind: Added | ||
body: >- | ||
branch create: Add `--[no-]commit` flag | ||
and accompayning `spice.branchCreate.commit` configuration | ||
to create stacked branches without committing changes. | ||
time: 2024-08-15T05:33:53.799135-07: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
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,75 @@ | ||
# branch create --no-commit stacks branches | ||
# without committing staged changes. | ||
|
||
as 'Test <[email protected]>' | ||
at '2024-08-15T05:26:12Z' | ||
|
||
cd repo | ||
git init | ||
git commit --allow-empty -m 'Initial commit' | ||
gs repo init | ||
|
||
git add foo.txt | ||
gs bc --no-commit feat1 | ||
|
||
git status --porcelain | ||
cmp stdout $WORK/golden/foo-staged.txt | ||
gs ls | ||
cmp stderr $WORK/golden/ls-feat1.txt | ||
|
||
# make it the default, try again | ||
git config spice.branchCreate.commit false | ||
git add bar.txt | ||
gs bc feat2 | ||
|
||
git status --porcelain | ||
cmp stdout $WORK/golden/both-staged.txt | ||
gs ls | ||
cmp stderr $WORK/golden/ls-feat2.txt | ||
|
||
# commit opt-in overrides the config | ||
gs bc --commit feat3 -m 'Add foo and bar' | ||
git status --porcelain | ||
cmp stdout $WORK/golden/clean.txt | ||
gs ls | ||
cmp stderr $WORK/golden/ls-feat3.txt | ||
|
||
git graph --branches | ||
cmp stdout $WORK/golden/final-graph.txt | ||
|
||
gs ll | ||
cmp stderr $WORK/golden/ll-feat3.txt | ||
|
||
-- repo/foo.txt -- | ||
foo | ||
-- repo/bar.txt -- | ||
bar | ||
|
||
-- golden/clean.txt -- | ||
-- golden/foo-staged.txt -- | ||
A foo.txt | ||
?? bar.txt | ||
-- golden/both-staged.txt -- | ||
A bar.txt | ||
A foo.txt | ||
-- golden/ls-feat1.txt -- | ||
┏━■ feat1 ◀ | ||
main | ||
-- golden/ls-feat2.txt -- | ||
┏━■ feat2 ◀ | ||
┏━┻□ feat1 | ||
main | ||
-- golden/ls-feat3.txt -- | ||
┏━■ feat3 ◀ | ||
┏━┻□ feat2 | ||
┏━┻□ feat1 | ||
main | ||
-- golden/ll-feat3.txt -- | ||
┏━■ feat3 ◀ | ||
┃ 2a17718 Add foo and bar (now) | ||
┏━┻□ feat2 | ||
┏━┻□ feat1 | ||
main | ||
-- golden/final-graph.txt -- | ||
* 2a17718 (HEAD -> feat3) Add foo and bar | ||
* 356f4ce (main, feat2, feat1) Initial commit |