### Setup remote repository with shamhub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_unsubmitted_base.txt Initializes a shamhub repository, registers a user, creates a new remote repository, and pushes the initial commit. Requires shamhub to be installed and configured. ```bash shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main ``` -------------------------------- ### Build git-spice from source Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install the Go compiler and then use 'go install' to build and install git-spice from its Go module path. ```bash go install go.abhg.dev/gs@latest ``` -------------------------------- ### Install git-spice with ubi Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install git-spice using the ubi binary installation tool by specifying the project. ```bash ubi --project abhinav/git-spice --exe git-spice ``` -------------------------------- ### Setup Git Repository and Initial Commit Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_amend_no_verify.txt Initializes a Git repository, creates an initial commit, and sets up a feature branch. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git checkout -b feature gs branch track --base main ``` -------------------------------- ### Example Repository File Content Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_submit.txt These are example file contents within the repository, demonstrating different features. ```text This is feature 1 ``` ```text This is feature 2 ``` ```text This is feature 3 ``` -------------------------------- ### Setup Main Repository in Worktree Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_restack_worktree_conflict.txt Initializes a Git repository and commits a file. Use this to set up the primary worktree. ```bash cd wt1 git init git add init.txt git commit -m 'Initial commit' gs repo init ``` -------------------------------- ### Setup Git Repository and Branches Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_pick_deletion.txt Initializes a Git repository, creates branches, and adds files. This sets up the scenario for testing commit picking. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git config spice.experiment.commitPick true # Create lower branch. git add lower1.txt lower2.txt gs branch create lower -m 'Add lower branch files' # Stack upper on top of lower, # with a deletion meant for lower. git add upper1.txt upper2.txt gs branch create upper -m 'Add upper files' git rm lower1.txt gs commit create -m 'Delete lower1' gs down ``` -------------------------------- ### Setup Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_onto.txt Initializes a Git repository, creates multiple branches with commits, and sets up the initial branch structure. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git add feature1.txt gs branch create feature1 -m 'Add feature 1' git add feature2.txt gs branch create feature2 -m 'Add feature 2' git add feature3.txt gs branch create feature3 -m 'Add feature 3' ``` -------------------------------- ### Setup Git Repository and Branches Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/repo_init_prompt_multiple_local.txt Initializes a Git repository, creates an initial commit, and sets up multiple local branches ('foo', 'bar', 'main') for testing. ```bash mkdir repo cd repo git init -b main git commit --allow-empty -m 'Initial commit' git branch foo git branch bar ``` -------------------------------- ### Install git-spice with Homebrew Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Use Homebrew to install git-spice from the default core formulae. ```bash brew install git-spice ``` -------------------------------- ### Setup Git Repository and Initial Commit Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_upstream_name_wrong_remote.txt Initializes a new Git repository, creates an initial commit, and clones it to set up a forked repository for testing. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' cd .. git clone repo fork cd fork ``` -------------------------------- ### Initialize Git Repository and Add Files Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_fixup_errors.txt Basic setup for testing commit fixup scenarios, including initializing a repository, creating initial commits, and adding files. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git add init.txt gs cc -m 'Add init file' ``` -------------------------------- ### Example Content of edit/give.txt Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_edit.txt This file provides an example of input that would invert the order of the branches in the stack. ```text # Invert the order completely. feature1 feature2 feature3 ``` -------------------------------- ### Setup Git Repository and Remote Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_stale_base.txt Initializes a Git repository, sets up a fake GitHub remote using shamhub, and pushes the initial commit. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Setup Git Repository and Remote Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_merge_explicit_branch.txt Initializes a Git repository, configures Git Spice experiments, and sets up a fake GitHub remote using shamhub. ```bash cd repo git init git config spice.experiment.merge true git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Install git-spice .rpm package for openSUSE Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install the git-spice .rpm package on openSUSE systems. ```bash sudo zypper install ./git-spice--1..rpm ``` -------------------------------- ### Install git-spice with mise Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install git-spice globally using the mise tool, referencing it directly from GitHub. ```bash mise use --global 'github:abhinav/git-spice' ``` -------------------------------- ### Setup Repository and Git Configuration Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_multiple_pr_templates.txt Initializes a Git repository, adds a template file, and configures a fake remote using shamhub. This sets up the environment for testing 'branch submit'. ```bash cd repo git init git add .shamhub CHANGE_TEMPLATE.md git commit -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Setup for 'repo init' Failure Test Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/repo_init_non_interactive_err.txt This setup involves creating a repository, initializing it with a main branch, and configuring multiple local branches and remotes. This environment is used to test the failure cases of 'repo init' in non-interactive mode. ```bash mkdir repo cd repo git init -b main git commit --allow-empty -m 'Initial commit' git branch foo git branch bar git remote add origin https://example.com/foo-fork.git git remote add upstream https://example.com/foo.git ``` -------------------------------- ### Setup Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_diff_flag.txt Initializes a new Git repository and a Git Spice repository. This is a prerequisite for performing branch operations. ```bash mkdir repo cd repo git init git add init.txt git commit -m 'Initial commit' gs repo init ``` -------------------------------- ### Setup Git Spice and Shamhub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_with_reviewers.txt Initialize a Git repository, set up a fake remote using shamhub, and authenticate with Git Spice. This is a prerequisite for testing submission scenarios. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice shamhub register bob shamhub register charlie git push origin main env SHAMHUB_USERNAME=alice gs auth login ``` -------------------------------- ### Setup Git repository and remote Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_pr_template_no_body.txt Initializes a Git repository, adds a file, commits it, and sets up a fake remote repository for testing purposes. This includes pushing the initial commit to the remote. ```bash cd repo git init git add .shamhub git commit -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Setup Upstream Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/issue351_submit_no_publish_unsupported_forge.txt Initializes a bare Git repository that will serve as the upstream remote. This setup is a prerequisite for testing push operations. ```bash mkdir upstream cd upstream git init git commit --allow-empty -m 'Initial commit' git config receive.denyCurrentBranch updateInstead ``` -------------------------------- ### Example gs ll output after configuring change URLs Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/config_log_change_format.txt This is an example of the 'gs ll' output after the 'spice.log.crFormat' has been set to 'url'. The change URL is shown for feat1. ```text ┏━■ feat3 ◀ ┃ 7b5eba4 feat3 (now) ┏━┻□ feat2 ┃ 562c8c6 feat2 (now) ┏━┻□ feat1 ($SHAMHUB_URL/alice/example/changes/1) ┃ ecc906e feat1 (now) main ``` -------------------------------- ### Setup Git Repository and ShamHub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_with_assignees.txt Initializes a Git repository, sets up a fake GitHub remote using 'shamhub', and pushes the main branch. This is a prerequisite for simulating branch submissions. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice shamhub register bob shamhub register charlie shamhub register dave git push origin main ``` -------------------------------- ### Example file content Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_edit_inserted_at_bottom_with_downstack_history.txt Provides the content of feature files used in the repository. ```text -- repo/feature1.txt -- Feature 1 -- repo/feature2.txt -- Feature 2 -- repo/feature3.txt -- Feature 3 -- repo/feature4.txt -- Feature 4 ``` -------------------------------- ### Initialize Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/repo_restack_autostash_apply_conflict.txt Sets up a new Git repository for the demonstration. ```bash cd repo git init git commit -m 'Initial commit' --allow-empty gs repo init ``` -------------------------------- ### Initialize and Register with ShamHub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/forge_kind_alias_remote.txt Initializes a Git repository, creates an initial commit, and sets up ShamHub with a new remote origin pointing to an example repository. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main ``` -------------------------------- ### Set Up Environment and Authenticate Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_submit_web.txt Configures environment variables for browser recording and shamhub username, then authenticates with Google Cloud. ```bash env BROWSER_RECORDER_FILE=$WORK/browser.txt env SHAMHUB_USERNAME=alice gs auth login ``` -------------------------------- ### Bootstrap Development Environment with Mise Source: https://github.com/abhinav/git-spice/blob/main/CONTRIBUTING.md Use this script to open a shell session with mise and all tools installed, keeping them within the project directory. This is useful if you prefer not to alter your global setup. ```bash ./tools/bin/mise en ``` -------------------------------- ### Setup Git Repository and Shamhub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_navigation_comment_downstack_open.txt Initializes a git repository, sets up a fake GitHub remote using shamhub, and pushes the initial commit. This is a prerequisite for testing git-spice functionality. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub register alice shamhub new origin alice/example.git env SHAMHUB_USERNAME=alice gs auth login git push origin main ``` -------------------------------- ### Setup Branch with Commits Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_split_reassign_submitted.txt Creates a branch named 'features' with three distinct commits. ```bash git add feat1.txt github bc -m feat1 features git add feat2.txt github cc -m feat2 git add feat3.txt github cc -m feat3 ``` -------------------------------- ### Initialize Git Repository and Add Files Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_delete_prompt_sort_order.txt Sets up a new Git repository, initializes Git Spice, and adds/commits initial files. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init ``` ```bash git add aaa.txt gs bc aaa -m 'Add aaa' ``` ```bash git checkout -b ccc git add ccc.txt git commit -m 'Add ccc' ``` ```bash gs trunk git add bbb.txt gs bc bbb -m 'add bbb.txt' ``` -------------------------------- ### Setup Git Repository and Hooks Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_create_no_verify.txt Initializes a Git repository, creates an initial commit, and sets up a dummy pre-commit hook that always exits with an error. This hook is intended to be bypassed by the --no-verify flag. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git checkout -b feature gs branch track --base main cp $WORK/extra/pre-commit .git/hooks/pre-commit chmod 700 .git/hooks/pre-commit ``` ```bash #!/bin/sh exit 1 ``` -------------------------------- ### Setup Repository for Rebase Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_create_rebase.txt Initializes a Git repository, creates some commits, and sets up the repository for a rebase operation. Ensure 'gs' is aliased to 'git spice'. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init ``` ```bash git add feature1.txt gs bc -m 'Add feature 1' feature1 git add feature2.txt gs bc -m 'Add feature 2' feature2 git add feature3.txt gs bc -m 'Add feature 3' feature3 ``` ```bash git graph --branches cmp stdout $WORK/golden/graph-before.txt ``` ```bash env EDITOR=mockedit MOCKEDIT_GIVE=$WORK/input/rebase-todo.txt git rebase -i HEAD~3 ``` -------------------------------- ### Set up Main -> Feat1 -> Feat2 Branch Structure Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_onto_diverged_from_base.txt Creates a 'feat1' branch, adds 'feat2.txt', commits it as 'feat2', and then adds 'feat1.txt' to the 'feat1' branch. ```bash gs bc --no-commit feat1 git add feat2.txt gs bc feat2 -m "Add feature 2" gs ll cmp stderr $WORK/golden/ls-before.txt # add a commit to feat1 gs down git add feat1.txt git commit -m "Add feature 1" gs up stderr 'feat2: needs to be restacked' ``` -------------------------------- ### Initialize and Setup Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_fold.txt Initializes a Git repository and sets up two branches with commits. This is a prerequisite for demonstrating the branch fold operation. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init # setup git add foo.txt gs bc foo -m 'Add foo.txt' git add bar.txt gs bc bar -m 'Add bar.txt' ``` -------------------------------- ### Install Failing Pre-push Hook Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_recover_prepared.txt Installs a pre-push hook that will cause the submission to fail. ```bash mkdir .git/hooks cp $WORK/hooks/pre-push .git/hooks/pre-push chmod 755 .git/hooks/pre-push ``` -------------------------------- ### Initialize Repository and Push to ShamHub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/repo_sync_restack_autostash_second_target_conflict.txt Sets up a local repository, adds initial files, commits them, and pushes to a ShamHub remote. This is a prerequisite for subsequent operations. ```bash cd repo git init git add conflict.txt dirty.txt git commit -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Setup Git Repository and Commits Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_onto_retarget_upstack.txt Initializes a Git repository, creates empty commits, and adds feature branches with initial commits. This sets up the environment for demonstrating the 'branch onto' functionality. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git add feature1.txt gs bc -m feature1 git add feature2.txt gs bc -m feature2 git add feature3.txt gs bc -m feature3 ``` -------------------------------- ### Initialize ShamHub Server Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/README.md Run this command before any other shamhub commands. It starts a ShamHub server and sets environment variables for connection. ```bash shamhub init ``` -------------------------------- ### Install git-spice .deb package Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install the git-spice .deb package on Debian-based systems like Ubuntu. ```bash sudo apt install ./git-spice__.deb ``` -------------------------------- ### Initialize and Configure Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/issue897_repo_sync_with_worktree_branch.txt Sets up a local repository, initializes a remote 'shamhub' repository, and logs in the user to Git Spice. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main gs repo init --trunk=main env SHAMHUB_USERNAME=alice gs auth login ``` -------------------------------- ### Install git-spice with Homebrew Tap Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install the latest release of git-spice using a specific Homebrew tap. ```bash brew install --cask abhinav/tap/git-spice ``` -------------------------------- ### Initialize and Push a Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/config_log_combined_change_format.txt Sets up a new repository, initializes Shamhub, registers a user, creates a fake remote, and pushes the initial commit. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' # set up a fake remote shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main ``` -------------------------------- ### Setup Repository for Branch Deletion Test Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_delete_prompt_untracked.txt Initializes a new Git repository, creates several branches, and checks out one of them to prepare for the branch deletion test. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'initial commit' gs repo init git branch a git branch b git branch c git branch d git checkout c ``` -------------------------------- ### Install git-spice from AUR with yay Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md An alternative method to install the git-spice-bin package from the AUR using the yay helper. ```bash yay -S git-spice-bin ``` -------------------------------- ### Initialize Repository and Create Branches Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_delete_rebase_conflict.txt Sets up a git repository, initializes git-spice, and creates initial branches for testing. ```bash cd repo git init git commit --allow-empty -m 'initial commit' gs repo init git add feature1.txt gs bc -m feature1 cp $WORK/extra/feature1-extra.txt feature1.txt git add feature1.txt feature2.txt gs bc -m feature2 ``` -------------------------------- ### Install Git Credential Manager on macOS Source: https://github.com/abhinav/git-spice/blob/main/doc/src/setup/auth.md Installs Git Credential Manager using the Homebrew package manager on macOS. ```sh brew install git-credential-manager ``` -------------------------------- ### Install git-spice .rpm package for Fedora/RHEL Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install the git-spice .rpm package on Fedora, RHEL, Rocky Linux, or AlmaLinux. ```bash sudo dnf install ./git-spice--1..rpm ``` -------------------------------- ### Initialize Git Repository and Add File Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_delete_unmerged.txt Sets up a new Git repository, creates an initial commit, and adds a file to be committed. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'initial commit' ``` ```bash git add foo.txt gs bc foo -m 'add foo.txt' ``` -------------------------------- ### Setup Git and Shamhub Remote Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_navigation_comment_opt_out_multiple.txt Initializes a git repository, sets up a fake GitHub remote using shamhub, and pushes the initial commit. Ensure SHAMHUB_USERNAME is set and you are authenticated with gs. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main env SHAMHUB_USERNAME=alice gs auth login ``` -------------------------------- ### Windows Worktree Prompt Example Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_prompt_worktree.txt Example of the interactive prompt for branch operations on a Windows system, showing worktree paths. ```text === > Select a branch to checkout: > ┏━□ feat3 > ┏━┻□ feat2 [wt: ~\feat2] > ┏━┻□ feat1 [wt: ~\feat1] > main ◀ "feat3" === > Select a branch to delete: > ┏━■ feat3 ◀ > ┏━┻□ feat2 [wt: ~\feat2] > ┏━┻□ feat1 [wt: ~\feat1] > main "feat3" === > Select a branch to move onto: > ┏━□ feat2 > ┏━┻■ feat1 [wt: ~\feat1] ◀ > main > > Moving feat2 onto another branch "main" ``` -------------------------------- ### Unix Worktree Prompt Example Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_prompt_worktree.txt Example of the interactive prompt for branch operations on a Unix-like system, showing worktree paths. ```text === > Select a branch to checkout: > ┏━□ feat3 > ┏━┻□ feat2 [wt: ~/feat2] > ┏━┻□ feat1 [wt: ~/feat1] > main ◀ "feat3" === > Select a branch to delete: > ┏━■ feat3 ◀ > ┏━┻□ feat2 [wt: ~/feat2] > ┏━┻□ feat1 [wt: ~/feat1] > main "feat3" === > Select a branch to move onto: > ┏━□ feat2 > ┏━┻■ feat1 [wt: ~/feat1] ◀ > main > > Moving feat2 onto another branch "main" ``` -------------------------------- ### Interactive Rebase Setup Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_amend_rebase.txt Prepares for an interactive rebase by setting the EDITOR environment variable to 'mockedit' and providing a rebase-todo file. This allows control over the rebase process, including breaking at specific commits. ```bash env EDITOR=mockedit MOCKEDIT_GIVE=$WORK/input/rebase-todo.txt git rebase -i HEAD~3 ``` -------------------------------- ### Set up Repository with Remote Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/repo_init_trunk_remote_ref_err.txt Initializes a Git repository, creates an initial commit, sets up a shamhub remote, and pushes the main branch. This prepares the environment for testing the 'repo init' failure. ```bash mkdir repo cd repo git init -b main git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git git push origin main ``` -------------------------------- ### Example Authentication Prompt Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/auth_prompt_forge.txt This snippet shows an example of an authentication prompt for selecting a forge, with 'shamhub' being the selected option. ```text === > Select a Forge: > > ▶ bitbucket > gitea > github > gitlab > shamhub "shamhub" ``` -------------------------------- ### Initialize Git Repository and ShamHub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_dry_run_labels.txt Sets up a local Git repository, initializes ShamHub, registers a user, creates a remote repository, and pushes the initial commit. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main ``` -------------------------------- ### Install git-spice from Ubuntu PPA Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Add the official git-spice PPA to your Ubuntu system, update package lists, and install git-spice. ```bash sudo add-apt-repository ppa:abhg/git-spice sudo apt update sudo apt install git-spice ``` -------------------------------- ### Specify Starting Branch Source: https://github.com/abhinav/git-spice/blob/main/doc/includes/cli-reference.md Use the --branch flag to specify a different branch to start the submission from, instead of the current branch. ```bash gs downstack submit --branch=develop ``` -------------------------------- ### Install git-spice .apk package for Alpine Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install the git-spice .apk package on Alpine Linux. Use --allow-untrusted if the package is not signed. ```bash sudo apk add --allow-untrusted ./git-spice--r1..apk ``` -------------------------------- ### Install git-spice from AUR Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/install.md Install the git-spice-bin package from the Arch User Repository (AUR). This involves cloning the repository, navigating into it, and running makepkg. ```bash git clone https://aur.archlinux.org/git-spice-bin.git cd git-spice-bin makepkg -si ``` -------------------------------- ### Initialize Git Repository and ShamHub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_zero_commits.txt Sets up a local Git repository, initializes ShamHub, registers a user, and pushes an initial commit to a remote repository. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init # setup remote shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main env SHAMHUB_USERNAME=alice gs auth login ``` -------------------------------- ### Example Branch Listing Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_checkout_track_prompt.txt This is an example of the output from `gs ls -a`, showing the currently checked-out branch ('feature') marked with an arrow. ```text ┏━■ feature ◀ main ``` -------------------------------- ### Initialize Git Repository and gs Repo Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_delete_current.txt Sets up a new Git repository and initializes it with gs repo. This is a prerequisite for subsequent commands. ```bash cd repo git init git commit --allow-empty -m 'initial commit' gs repo init ``` -------------------------------- ### CLI command structure example Source: https://github.com/abhinav/git-spice/blob/main/DESIGN.md Illustrates the noun-verb CLI command structure for git-spice, with examples of full commands and potential short-hand aliases. ```shell gs [noun] [verb] gs stack submit gs branch create feature1 gs branch checkout feature1 gs commit create gs commit amend gs ss gs bc feature1 gs bco feature1 gs cc gs ca ``` -------------------------------- ### Initialize Git Repository and ShamHub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/issue944_special_chars_in_branch_names.txt Sets up a new Git repository, initializes ShamHub, and pushes the initial commit to the remote. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main ``` -------------------------------- ### Install Failing Pre-Push Hook Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_no_verify.txt Installs a custom pre-push hook script that is designed to fail, simulating a scenario where a push would normally be blocked. ```bash mkdir -p .git/hooks cp $WORK/extra/pre-push .git/hooks/pre-push chmod 755 .git/hooks/pre-push ``` -------------------------------- ### Initialize and Register Repositories Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_fork_stacked.txt Initializes a Shamhub repository and registers Alice and Bob as users. Sets up the 'upstream' remote for Alice's store. ```bash mkdir -p alice/store cd alice/store git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub register alice shamhub register bob shamhub new upstream alice/store git push upstream main ``` -------------------------------- ### Example Git Graph Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/upstack_onto_prompt_sort_order.txt This is an example of the Git graph output after the 'upstack onto' operation, showing the resulting branch structure and commit history. ```text * 5646a25 (ccc) Add feature 2 | * f062ab3 (HEAD -> bbb) Add feature 3 | * d80c805 (aaa) Add feature 1 |/ * 9778e0e (main) Initial commit ``` -------------------------------- ### Example workflow: Update existing PRs Source: https://github.com/abhinav/git-spice/blob/main/doc/src/guide/cr.md This example demonstrates updating 'fish' and 'bird' PRs while 'goat' is still in progress, using the --update-only flag. ```terminal # While working in goat, make a minor fixup to bird. gs commit create -m 'bird: preen a little' # Pull that change into bird gs branch checkout bird git restore --source $(gs top -n) -- bird.go gs commit create -a -m 'preen a little' INF fish: restacked on bird INF goat: restacked on fish # Update fish and bird in one command without submitting goat gs stack submit --update-only INF bird: Updated #1 INF goat: Updated #2 INF goat: Skipping unsubmitted branch: --update-only ``` -------------------------------- ### Initialize Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/auth_insecure_storage.txt Sets up a new Git repository and performs an initial commit. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' ``` -------------------------------- ### Example Branch Prompt Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/upstack_onto_prompt_sort_order.txt This is an example of the expected output from the Git Spice branch prompt when sorting is configured by 'committerdate'. It shows the branches ordered by their commit dates. ```text === > Select a branch to move onto: > ┏━□ bbb > ┣━□ ccc > ┣━□ aaa > main ◀ > > Moving the upstack of bbb onto another branch "aaa" ``` -------------------------------- ### Initialize Repository and Configure Git Spice Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_pick_basic.txt Sets up a new Git repository, initializes Git Spice, and enables the commit pick experiment. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git config spice.experiment.commitPick true ``` -------------------------------- ### Example gs ls output after configuring change URLs Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/config_log_change_format.txt This is an example of the 'gs ls' output after the 'spice.log.crFormat' has been set to 'url'. Notice that the change URL is displayed for feat1. ```text ┏━■ feat3 ◀ ┏━┻□ feat2 ┏━┻□ feat1 ($SHAMHUB_URL/alice/example/changes/1) main ``` -------------------------------- ### Initialize Repository and Create Commits Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_edit_interrupt.txt Sets up a Git repository and creates initial commits and branches. This is a prerequisite for demonstrating branch editing. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git add feature1.txt gs bc -m 'Add feature 1' feature1 git add feature2.txt gs bc -m 'Add feature 2' feature2 git add feature3.txt gs bc -m 'Add feature 3' feature3 gs bottom ``` -------------------------------- ### Initialize and Commit in Git Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_delete_detached_head.txt Sets up a new repository, performs an initial commit, and initializes git-spice. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'initial commit' gs repo init ``` -------------------------------- ### Feature File Content Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_submit_with_reviewers.txt Content for feature files used in the stack submission examples. ```text -- repo/feature1.txt -- This is feature 1 -- repo/feature2.txt -- This is feature 2 -- repo/feature3.txt -- This is feature 3 ``` -------------------------------- ### Initialize and Configure Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_config_no_publish.txt Sets up a local Git repository and a fake remote using `shamhub` for testing purposes. Authenticates with `gs`. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main env SHAMHUB_USERNAME=alice gs auth login ``` -------------------------------- ### Verify Current Branch After Restack Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_restack_linear.txt Confirms that the operation returns to the starting branch ('feature3'). ```bash git branch --show-current stdout '^feature3$' ``` -------------------------------- ### Run 'gs repo init' and Capture Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/repo_init_prompt_multiple_local.txt Checks out the 'foo' branch and then runs 'gs repo init', capturing the actual output for comparison with the expected golden file. ```bash env ROBOT_INPUT=$WORK/robot.golden ROBOT_OUTPUT=$WORK/robot.actual git checkout foo gs repo init cmp $WORK/robot.actual $WORK/robot.golden ``` -------------------------------- ### RestackHandler Interface Source: https://github.com/abhinav/git-spice/blob/main/internal/handler/AGENTS.md Defines a narrow interface for a RestackHandler, focusing only on the 'RestackBranch' behavior. This is an example of handler-to-handler dependency composition. ```go type RestackHandler interface { RestackBranch(ctx context.Context, branch string) error } type Handler struct { Restack RestackHandler // required } ``` -------------------------------- ### Initialize and Configure Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_recover_prepared.txt Sets up a new Git repository and configures a remote using shamhub. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub register alice shamhub new origin alice/example.git git push origin main env SHAMHUB_USERNAME=alice gs repo init gs auth login ``` -------------------------------- ### Initialize Git Repository and Spice Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_pick_untracked_files.txt Sets up a new Git repository and initializes 'spice' with commit picking experiments enabled. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' ``` ```bash gs repo init git config spice.experiment.commitPick true ``` -------------------------------- ### Authenticate and Submit Stack Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_submit_multiple_merged_history.txt Logs in to shamhub and submits the entire stack of pull requests starting from the 'feature1' branch. ```bash env SHAMHUB_USERNAME=alice gs auth login git checkout feature1 gs stack submit --fill ``` -------------------------------- ### Example Git Log Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_edit.txt This is the expected output of 'git graph --branches' after the stack has been reordered and changes applied. ```text * ed4680e (HEAD -> feature1) Add feature 1 * c5b835f (feature2) Add feature 2 * 8039b1d (feature3) Add feature 3 * b91c6c5 (main) Initial commit ``` -------------------------------- ### Initialize Git Repository and Add Features Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/upstack_restack_repeated_conflicts.txt Sets up a new Git repository, initializes it, and adds initial features. This is a prerequisite for demonstrating conflict resolution. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init ``` ```bash cp $WORK/extra/feature1.txt feature1.txt git add feature1.txt gs bc -m feature1 ``` ```bash cp $WORK/extra/feature2.txt feature2.txt git add feature2.txt gs bc -m feature2 ``` ```bash cp $WORK/extra/feature3.txt feature3.txt git add feature3.txt gs bc -m feature3 ``` -------------------------------- ### Initialize Git Repository and Create Commits Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_split_reuse_name_non_interactive.txt Sets up a local git repository, initializes it, creates an initial commit, and then adds three feature files with corresponding commits. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git add feature1.txt gs bc -m 'Add feature1' features git add feature2.txt gs cc -m 'Add feature2' git add feature3.txt gs cc -m 'Add feature3' ``` -------------------------------- ### Edit commits in a branch Source: https://github.com/abhinav/git-spice/blob/main/doc/includes/cli-reference.md Starts an interactive rebase for commits within the current branch. Upstack branches will be restacked after the rebase. ```bash gs branch edit ``` -------------------------------- ### Authenticate and Submit Stack with Labels Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_submit_with_labels.txt Logs in to shamhub and submits the entire stack starting from 'feature1' with multiple labels applied. ```bash env SHAMHUB_USERNAME=alice gs auth login # The old singular key remains a deprecated compatibility alias. git config spice.submit.label spice # submit the entire stack from the middle. git checkout feature1 gs stack submit --fill --label label1 --label label2,label3 stderr 'configuration option' stderr 'spice.submit.label' stderr 'spice.submit.labels' stderr 'Created #1' stderr 'Created #2' stderr 'Created #3' ``` -------------------------------- ### Setup Git Repository and Spice Configuration Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_merge_upstack_chain.txt Initializes a Git repository, configures Git Spice for merging experiments, and creates an initial commit. It also sets up a fake GitHub remote using 'shamhub' and pushes the main branch. ```bash cd repo git init git config spice.experiment.merge true git commit --allow-empty -m 'Initial commit' # set up a fake GitHub remote shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Initiate Downstack Restack and Handle First Conflict Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_restack_conflict.txt Starts a downstack restack from feature3 and handles the initial conflict in feature1.txt. ```bash gs branch checkout feature3 ! gs downstack restack stderr 'There was a conflict' git status --porcelain cmp stdout $WORK/golden/conflict-status-feature1.txt cp $WORK/extra/feature1.resolved.txt feature1.txt git add feature1.txt ! gs rebase continue --no-edit stderr 'There was a conflict' ``` -------------------------------- ### Start a Rebase Edit Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_amend_rebase_edit_no_prompt.txt Initiates a rebase operation that deliberately stops at an 'edit' instruction for the current commit. This is a conflict-free stop. ```bash env EDITOR=mockedit MOCKEDIT_GIVE=$WORK/input/rebase-todo.txt ! gs branch edit ``` -------------------------------- ### Initialize Git Repository Source: https://github.com/abhinav/git-spice/blob/main/doc/src/start/stack.md Set up a new Git repository and create an initial commit before initializing git-spice. ```bash mkdir repo cd repo git init git commit --allow-empty -m "Initial commit" ``` -------------------------------- ### Initialize and Configure Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_submit_ambiguous_branch.txt Sets up a new Git repository, makes an initial commit, and configures a fake GitHub remote using `shamhub`. This is a prerequisite for testing branch submission scenarios. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Start Capturing Git-Spice Output Source: https://github.com/abhinav/git-spice/blob/main/doc/includes/captures/README.txt Use the 'script' command to begin capturing terminal output. Type 'exit' to stop. ```bash script foo.txt ``` ```bash gs branch submit ``` ```bash exit ``` -------------------------------- ### Setup Repository for Rebase Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_amend_rebase.txt Initializes a Git repository, creates several commits, and sets up the repository for an interactive rebase. This includes creating initial commits and using Git Spice's `bc` command for branching commits. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git add feature1.txt gs bc -m 'Add feature 1' feature1 git add feature2.txt gs bc -m 'Add feature 2' feature2 git add feature3.txt gs bc -m 'Add feature 3' feature3 ``` -------------------------------- ### Initialize Git Repository and Create Branches Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/up_multiple_prompt.txt Sets up a new Git repository, initializes it, and creates multiple branches ('head1', 'head2', 'head3') for demonstration purposes. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init gs bc head1 -m 'head1' gs down gs bc head2 -m 'head2' gs down gs bc head3 -m 'head3' gs down ``` -------------------------------- ### Example Branch Content Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_track_linear_interactive.txt Defines the content for various feature branch files. This is used to populate the repository before performing Git operations. ```text -- repo/feat1.txt -- feature 1 -- repo/feat2.txt -- feature 2 -- repo/feat3.txt -- feature 3 -- repo/feat4.txt -- feature 4 -- repo/feat5.txt -- feature 5 -- repo/feat6.txt -- feature 6 -- repo/feat7.txt -- feature 7 -- repo/feat8.txt -- feature 8 ``` -------------------------------- ### Windows Branch List Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_prompt_worktree.txt Example output of `gs ls -a` on Windows, showing branches and their associated worktree paths. ```text ┏━□ feat1 [wt: ~\feat1] ┣━■ feat2 ◀ main ``` -------------------------------- ### Initialize Git Repository and Stack Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_edit_non_linear.txt Sets up a new Git repository, initializes a Git-Spice stack, and creates initial branches for the stack. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git add feature1.txt gs branch create feature1 -m 'Add feature 1' git add feature2.txt gs branch create feature2 -m 'Add feature 2' gs down git add feature3.txt gs branch create feature3 -m 'Add feature 3' ``` -------------------------------- ### Unix Branch List Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_prompt_worktree.txt Example output of `gs ls -a` on Unix, showing branches and their associated worktree paths. ```text ┏━□ feat1 [wt: ~/feat1] ┣━■ feat2 ◀ main ``` -------------------------------- ### Initialize Repository and Create Stack Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_restack_skip_worktree.txt Sets up a Git repository and creates a non-linear branch stack for demonstration purposes. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init # Create first stack: feaure1-3 git add feature1.txt gs bc feature1 -m 'Add feature1' git add feature2.txt gs bc feature2 -m 'Add feature2' git add feature3.txt gs bc feature3 -m 'Add feature3' # Go back to feature1 and create 4-5 gs bco feature1 git add feature4.txt gs bc feature4 -m 'Add feature4' git add feature5.txt gs bc feature5 -m 'Add feature5' ``` -------------------------------- ### Perform 'branch fold' operation Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_fold_updates_upstacks.txt Executes the 'branch fold' command to update branch pointers. This is the core operation demonstrated in the example. ```bash gs bco feat1 gs branch fold ``` -------------------------------- ### Run Specific Test with Mise Source: https://github.com/abhinav/git-spice/blob/main/CONTRIBUTING.md Run a specific test script, for example, 'auth_detect_forge.txt', using the test:script mise task. ```bash mise run test:script --run auth_detect_forge ``` -------------------------------- ### Setup Upstream Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/issue391_repo_sync_pull_unsupported_forge.txt Initializes an upstream Git repository. Ensures the receive.denyCurrentBranch configuration is set to updateInstead to allow direct updates. ```bash mkdir upstream cd upstream git init git commit --allow-empty -m "Initial commit" git config receive.denyCurrentBranch updateInstead ``` -------------------------------- ### Initialize Git Repository and Spice Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/commit_fixup_conflict_staged.txt Sets up a new Git repository, initializes Git Spice, and enables the commit-fixup experiment. ```bash cd repo git init git commit --allow-empty -m 'Initial commit' gs repo init git config spice.experiment.commitFixup true ``` -------------------------------- ### Setup Stacked Branches Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/branch_rename.txt Creates two branches, 'oldname' and 'above', with 'above' stacked on top of 'oldname'. This sets up the scenario for renaming. ```bash git add foo.txt gs branch create oldname -m 'Do things' git add bar.txt gs branch create above -m 'Branch above oldname' ``` -------------------------------- ### Fish Shell Completion Setup Source: https://github.com/abhinav/git-spice/blob/main/doc/src/setup/shell.md Add this line to your config.fish to enable Fish shell completion. Assumes 'gs' is aliased to 'git-spice'. ```fish eval "$(gs shell completion fish)" ``` -------------------------------- ### Initialize and Configure Git Repository Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/issue725_pre_push_hook_worktree.txt Sets up a new Git repository, adds an initial file, and commits it. This is a prerequisite for testing Git hooks. ```bash mkdir repo cd repo git init git add required.txt git commit -m 'initial commit' ``` -------------------------------- ### Initialize Git Repository and Shamhub Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/auth_explicit_forge.txt Sets up a new Git repository and initializes shamhub for managing remote repositories. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub new origin alice/example.git shamhub register alice git push origin main ``` -------------------------------- ### Restack from Untracked Branch Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/issue803_repo_restack_stay_on_current_branch.txt Tests the restack behavior when starting from a newly created, untracked branch. Ensures the current branch is maintained. ```bash git checkout -b untracked-branch gs repo restack git branch --show-current stdout 'untracked-branch' ``` -------------------------------- ### Initialize and Register User Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/auth_detect_forge.txt Sets up a new repository and registers a user with Shamhub. Ensure the environment variable SHAMHUB_USERNAME is set. ```bash mkdir repo cd repo git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub register alice env SHAMHUB_USERNAME=alice ``` -------------------------------- ### Authenticate with GitLab CLI Source: https://github.com/abhinav/git-spice/blob/main/doc/src/setup/auth.md Use this command to authenticate the GitLab CLI. Ensure the GitLab CLI is installed and authenticated before using Git-Spice with this method. ```terminal {green}${reset} glab auth login ``` -------------------------------- ### Authenticate with GitHub CLI Source: https://github.com/abhinav/git-spice/blob/main/doc/src/setup/auth.md Use this command to authenticate the GitHub CLI. Ensure the GitHub CLI is installed and authenticated before using Git-Spice with this method. ```terminal {green}${reset} gh auth login ``` -------------------------------- ### Example Comments JSON Output Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/upstack_submit_main.txt This JSON output shows comments for each change, including navigation links within the stack and a managed-by-git-spice footer. ```json [ { "change": 1, "body": "| This change is part of the following stack:\n\n - #1 ◀\n - #2\n - #3\n - #4\n\n Change managed by [git-spice](https://abhinav.github.io/git-spice/).\n " }, { "change": 2, "body": "| This change is part of the following stack:\n\n - #1\n - #2 ◀\n\n Change managed by [git-spice](https://abhinav.github.io/git-spice/).\n " }, { "change": 3, "body": "| This change is part of the following stack:\n\n - #1\n - #3 ◀\n - #4\n\n Change managed by [git-spice](https://abhinav.github.io/git-spice/).\n " }, { "change": 4, "body": "| This change is part of the following stack:\n\n - #1\n - #3\n - #4 ◀\n\n Change managed by [git-spice](https://abhinav.github.io/git-spice/).\n " } ] ``` -------------------------------- ### Initialize and Register Repositories Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/stack_submit_fork.txt Initializes a ShamHub repository, registers Alice and Bob as users, and creates an upstream repository. Pushes the initial commit to the upstream main branch. ```bash mkdir -p alice/store cd alice/store git init git commit --allow-empty -m 'Initial commit' shamhub init shamhub register alice shamhub register bob shamhub new upstream alice/store git push upstream main ``` ```bash cp $WORK/extra/base.txt readme.txt git add readme.txt git commit -m 'Add readme' git push upstream main ``` -------------------------------- ### Perform Downstack Merge Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_merge_upstack_rebase.txt Merges branches from the bottom of the stack upwards. This example merges only 'feature1' and retargets 'feature2' onto the updated trunk. ```bash gs bco feature1 env ROBOT_INPUT=$WORK/robot-merge.golden ROBOT_OUTPUT=$WORK/robot-merge.actual gs downstack merge ``` -------------------------------- ### Set up ShamHub Remote and Register User Source: https://github.com/abhinav/git-spice/blob/main/testdata/script/downstack_merge_squash.txt Initializes ShamHub, configures the merge method to squash, creates a new remote, and registers a user. ```bash shamhub init shamhub config mergeMethod squash shamhub new origin alice/example.git shamhub register alice ```