### Build CLI Application Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Navigate to the CLI application directory, install its dependencies, and build it. ```bash cd apps/cli yarn install yarn build ``` -------------------------------- ### Install Turbo Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Install Turbo globally using npm. Turbo is a build system used for the monorepo. ```bash npm install --global turbo ``` -------------------------------- ### Install Yarn Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Install Yarn globally using npm. This is a prerequisite for managing project dependencies. ```bash npm install --global yarn ``` -------------------------------- ### Install Charcoal via Homebrew Source: https://context7.com/danerwilliams/charcoal/llms.txt Install Charcoal using Homebrew for macOS and Linux systems. Verify the installation by checking the version. ```bash # Install Charcoal using Homebrew brew install danerwilliams/tap/charcoal # Verify installation gt --version ``` -------------------------------- ### Use Node Version Manager Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Ensure you are using the correct Node.js version for the project by running `nvm use` after installing nvm. ```bash nvm use ``` -------------------------------- ### Build Monorepo Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Install all project dependencies and build the entire monorepo using Yarn and Turbo. ```bash yarn install turbo run build ``` -------------------------------- ### Initialize Charcoal Repository Source: https://context7.com/danerwilliams/charcoal/llms.txt Initialize Charcoal in a Git repository to start tracking stacked branches. This creates the `.graphite_repo_config` file. You can specify a different trunk branch or reset tracking. ```bash # Initialize Charcoal in the current repository gt repo init # Initialize with a specific trunk branch (e.g., 'develop' instead of 'main') gt repo init --trunk develop # Reset all branch tracking and reinitialize gt repo init --reset ``` -------------------------------- ### Get Hashes for Homebrew Tap Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Calculate the SHA256 hash for downloaded binaries. This is required for the Homebrew tap. ```bash shasum -a 256 /path/to/mybinary ``` -------------------------------- ### Get Branch Stack from Remote Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt downstack get ` to fetch a specific branch and its ancestors from the remote repository, updating the local stack. ```bash gt downstack get feature-branch ``` -------------------------------- ### Force Overwrite Local Branches with Remote Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt downstack get --force` to fetch a branch from the remote and forcefully overwrite any conflicting local branches. ```bash gt downstack get feature-branch --force ``` -------------------------------- ### Configure Repository Name Source: https://context7.com/danerwilliams/charcoal/llms.txt Set the name of the repository. ```bash gt repo name set "myrepo" ``` -------------------------------- ### Show Classic Logging Style Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt log short --classic` to display the stack log in a traditional Git logging format. ```bash gt log short --classic ``` -------------------------------- ### Preview Stack Submission Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --dry-run` to preview which branches would be submitted as pull requests without actually creating them. ```bash gt stack submit --dry-run ``` -------------------------------- ### Stage All Changes and Continue Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt continue --all` to automatically stage all resolved changes and then continue the interrupted operation. ```bash gt continue --all ``` -------------------------------- ### Enable Fish Shell Integration Source: https://context7.com/danerwilliams/charcoal/llms.txt Enable command-line autocompletion for the Fish shell. ```bash gt fish ``` -------------------------------- ### Submit Stack with Confirmation Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --confirm` to prompt for confirmation before submitting each branch in the stack as a pull request. ```bash gt stack submit --confirm ``` -------------------------------- ### Submit Stack as Draft Pull Requests Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --draft` to submit the entire stack as draft pull requests. Draft PRs are not yet ready for review. ```bash gt stack submit --draft ``` -------------------------------- ### Configure PR Templates Source: https://context7.com/danerwilliams/charcoal/llms.txt Configure pull request templates for the repository. ```bash gt repo pr-templates ``` -------------------------------- ### Force Repository Sync Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt repo sync --force` to perform a full repository synchronization without any confirmation prompts. ```bash gt repo sync --force ``` -------------------------------- ### Configure User Branch Date Format Source: https://context7.com/danerwilliams/charcoal/llms.txt Set the date format for branch names. Use --no-date to disable. ```bash gt user branch-date --set "YYYY-MM-DD" ``` ```bash gt user branch-date --no-date ``` -------------------------------- ### Show Short Log of All Stacks Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt log short` to display a concise log of all stacks, showing branch relationships and PR status. ```bash gt log short ``` -------------------------------- ### Run CLI from Local Build Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Execute CLI commands directly from your local build. This command allows you to run `gt `. ```bash cd apps/cli yarn cli ``` -------------------------------- ### Run Tests on Entire Stack Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack test ""` to execute a given command (e.g., tests) on every branch in the current stack. ```bash gt stack test "npm test" ``` -------------------------------- ### Run Tests on Stack Including Trunk Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack test "" --trunk` to execute a command on all branches in the stack, including the trunk branch. ```bash gt stack test "npm test" --trunk ``` -------------------------------- ### Run Tests on Upstack Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt upstack test ""` to execute a command on branches from the current branch up to the tips of the stack. ```bash gt upstack test "cargo test" ``` -------------------------------- ### Select Branches for Stack Submission Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --select` to interactively choose which branches from the current stack should be submitted as pull requests. ```bash gt stack submit --select ``` -------------------------------- ### Run Single CLI Test Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Execute a single CLI test file. Provide the path to the `.js` test file located in the `dist` folder. ```bash cd apps/cli DEBUG=1 yarn test-one "" ``` -------------------------------- ### Publish (Undraft) Pull Requests Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --publish` to change existing draft pull requests to ready-for-review status. ```bash gt stack submit --publish ``` -------------------------------- ### Configure User Pager Source: https://context7.com/danerwilliams/charcoal/llms.txt Set the pager program for displaying output. ```bash gt user pager "less" ``` -------------------------------- ### Configure User Editor Source: https://context7.com/danerwilliams/charcoal/llms.txt Set the default text editor for Charcoal operations. ```bash gt user editor "vim" ``` -------------------------------- ### Show Stack Log in Reverse Order Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt log short --reverse` to display the short log with the newest entries at the bottom. ```bash gt log short --reverse ``` -------------------------------- ### Run CLI Tests Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Execute all tests for the CLI application with full trace enabled. Set the DEBUG environment variable to 1 for more verbose output. ```bash cd apps/cli DEBUG=1 yarn test --full-trace ``` -------------------------------- ### Run Tests on Downstack Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt downstack test ""` to execute a command on branches from the trunk up to the current branch. ```bash gt downstack test "make test" ``` -------------------------------- ### Run Subset of CLI Tests Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Run a specific subset of CLI tests by providing a test pattern. Useful for focusing on specific test cases. ```bash cd apps/cli DEBUG=1 yarn test --full-trace -g "test pattern" ``` -------------------------------- ### Configure Default PR Body Behavior Source: https://context7.com/danerwilliams/charcoal/llms.txt Set the default behavior for the PR body. ```bash gt user submit-body ``` -------------------------------- ### Submit Upstack as Pull Requests Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt upstack submit` to submit branches from the current branch up to the tips of the stack as pull requests. ```bash gt upstack submit ``` -------------------------------- ### Show Progress During Branch Deletion Sync Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt repo sync --show-delete-progress` to display progress updates while merged branches are being deleted during a repository sync. ```bash gt repo sync --show-delete-progress ``` -------------------------------- ### Full Repository Sync Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt repo sync` to perform a full synchronization of the local repository. This includes pulling changes from the trunk and deleting merged branches. ```bash gt repo sync ``` -------------------------------- ### Submit Entire Stack as Pull Requests Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit` to submit all branches in the current stack as pull requests to GitHub. This is the recommended way to submit a full stack. ```bash gt stack submit ``` -------------------------------- ### Configure Repository Owner Source: https://context7.com/danerwilliams/charcoal/llms.txt Set the owner of the repository. ```bash gt repo owner set "myorg" ``` -------------------------------- ### Add Reviewers to Stack Submission Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --reviewers` to specify a comma-separated list of users to add as reviewers to the submitted pull requests. ```bash gt stack submit --reviewers "user1,user2" ``` -------------------------------- ### Link `gt` to Local Build Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Link the `gt` command to a locally built version of the CLI, including a build step. After running `yarn dev`, you can use `gt `. ```bash cd apps/cli yarn dev ``` -------------------------------- ### Generate MacOS ARM Binary Source: https://github.com/danerwilliams/charcoal/blob/main/CONTRIBUTING.md Manually generate the MacOS ARM binary for releases from the CLI app directory. Specify the target Node version and output file name. ```bash yarn build-pkg -t node18-macos -o gt-macos-arm64 ``` -------------------------------- ### Create Stacked Branches Source: https://context7.com/danerwilliams/charcoal/llms.txt Create new branches that stack on top of the current branch. The `branch create` command automatically sets up parent-child relationships for stack tracking. Options include adding a commit message and staging changes. ```bash # Create a branch with a name gt branch create my-feature # Create a branch and commit staged changes with a message gt branch create -m "Add user authentication" # Create a branch, stage all changes, and commit gt branch create -am "Fix login bug" # Create and insert between current branch and its children gt branch create -i -m "Add middleware layer" # Shorthand alias gt b c my-feature ``` -------------------------------- ### Set Branch Name Prefix Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt user branch-prefix ""` to configure a user-specific prefix that will be automatically applied to new branches. ```bash gt user branch-prefix "username/" ``` -------------------------------- ### Configure Repository Remote Name Source: https://context7.com/danerwilliams/charcoal/llms.txt Set the name of the remote for the repository. ```bash gt repo remote set "origin" ``` -------------------------------- ### Sync Repository and Restack Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt repo sync --restack` to sync the repository and automatically restack any branches that were affected by the synchronization. ```bash gt repo sync --restack ``` -------------------------------- ### Submit Downstack as Pull Requests Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt downstack submit` to submit branches from the trunk up to the current branch as pull requests. ```bash gt downstack submit ``` -------------------------------- ### Generate Zsh Completion Script Source: https://context7.com/danerwilliams/charcoal/llms.txt Generate the command-line autocompletion script for the Zsh shell. ```bash gt completion zsh ``` -------------------------------- ### Force Track Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch track --force` to track a branch and force Charcoal to automatically detect its parent, even if it's not immediately obvious. ```bash gt branch track --force ``` -------------------------------- ### Generate Bash Completion Script Source: https://context7.com/danerwilliams/charcoal/llms.txt Generate the command-line autocompletion script for the Bash shell. ```bash gt completion bash ``` -------------------------------- ### Authenticate with GitHub CLI Source: https://context7.com/danerwilliams/charcoal/llms.txt Authenticate with GitHub CLI to enable Charcoal to create and manage pull requests. Requires GitHub CLI version 2.0.0 or higher. This command opens an interactive login. ```bash # Authenticate with GitHub (opens interactive GitHub CLI login) gt auth # Check if already authenticated # Output: "✅ Already authenticated with GitHub." or prompts for login ``` -------------------------------- ### Track Branch with Specific Parent Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch track --parent ` to track a branch and explicitly set its parent in the stack. ```bash gt branch track my-branch --parent feature-base ``` -------------------------------- ### Navigate Branches in Stack Source: https://context7.com/danerwilliams/charcoal/llms.txt Navigate between branches in your stack using directional commands. Charcoal understands parent-child relationships for intuitive movement. Supports moving up, down, to the bottom, or top of the stack, and checking out specific branches. ```bash # Move to parent branch (downstack) gt branch down # Move multiple levels down gt branch down -n 3 # Move to child branch (upstack) gt branch up # Move multiple levels up gt branch up -n 2 # Jump to bottom of stack (first branch after trunk) gt branch bottom # Jump to top of stack (prompts if ambiguous) gt branch top # Interactive branch checkout gt branch checkout # Checkout specific branch gt branch checkout feature-branch # Include untracked branches in selection gt branch checkout -u # Shorthand aliases gt b d # down gt b u # up gt b b # bottom gt b t # top gt b co # checkout ``` -------------------------------- ### Show Log for Only Current Stack Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt log short --stack` to filter the log output to show only branches belonging to the current stack. ```bash gt log short --stack ``` -------------------------------- ### Sync Repository Skipping Deletion Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt repo sync --no-delete` to synchronize the repository without deleting any merged branches. ```bash gt repo sync --no-delete ``` -------------------------------- ### Track an Existing Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch track ` to add an existing local branch to the Charcoal stack. Charcoal will attempt to automatically determine its parent. ```bash gt branch track my-branch ``` -------------------------------- ### Force Push Stack Submission Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --force` to force push the branches when creating or updating pull requests. This overwrites the remote branch. ```bash gt stack submit --force ``` -------------------------------- ### Show Long Format Stack Log Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt log long` to display a detailed log of the stack, including more information about each branch and its PR status. ```bash gt log long ``` -------------------------------- ### Submit Stack with PR Field Editing Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --edit` to submit the stack and open an editor for modifying pull request fields like title and body before submission. ```bash gt stack submit --edit ``` -------------------------------- ### Include Untracked Branches in Log Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt log short -u` to include branches that are not currently part of any tracked stack in the log output. ```bash gt log short -u ``` -------------------------------- ### Continue Operation After Merge Conflicts Source: https://context7.com/danerwilliams/charcoal/llms.txt After resolving merge conflicts during an operation like restacking, use `gt continue` to resume the process. ```bash gt continue ``` -------------------------------- ### Squash Branch with New Message Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch squash -m ""` to squash all commits in the current branch into a single commit with a specified commit message. ```bash gt branch squash -m "Combined changes" ``` -------------------------------- ### Sync Repository Skipping Pull Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt repo sync --no-pull` to synchronize the repository by only deleting merged branches, without pulling changes from the trunk. ```bash gt repo sync --no-pull ``` -------------------------------- ### Limit Stack Log Depth Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt log short -n N` to limit the stack log output to N levels up or down from the current branch. ```bash gt log short -n 3 ``` -------------------------------- ### Submit Current Branch as Pull Request Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch submit` to submit only the current branch as a pull request. ```bash gt branch submit ``` -------------------------------- ### Move Different Branch onto Target Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt upstack onto` with the `--source` flag to move a different branch onto a specified target branch. This is useful for restacking a feature branch onto another. ```bash gt upstack onto target-branch --source my-feature ``` -------------------------------- ### Split Branch by Hunks Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch split --by-hunk` to split the current branch into multiple new branches based on selected hunks (changes within commits). This opens an interactive editor. ```bash gt branch split --by-hunk ``` -------------------------------- ### Disable GitHub Integration Source: https://context7.com/danerwilliams/charcoal/llms.txt Disable GitHub integration for the repository. ```bash gt repo disable-github ``` -------------------------------- ### Split Branch by Commits Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch split --by-commit` to split the current branch into multiple new branches based on selected commits. This opens an interactive editor. ```bash gt branch split --by-commit ``` -------------------------------- ### Perform Commit Operations Source: https://context7.com/danerwilliams/charcoal/llms.txt Create and amend commits while automatically restacking dependent branches to maintain stack integrity. Supports creating new commits, amending existing ones, and interactive staging. ```bash # Create a new commit on the current branch gt commit create -m "Implement feature X" # Stage all changes and create commit gt commit create -am "Add tests for feature X" # Interactively pick hunks to stage gt commit create -pm "Partial implementation" # Amend the most recent commit gt commit amend -m "Updated commit message" # Amend without changing commit message gt commit amend --no-edit # Stage all and amend gt commit amend -a --no-edit # Shorthand aliases gt c c -m "New commit" gt c a --no-edit ``` -------------------------------- ### Move Branches Upstack Source: https://context7.com/danerwilliams/charcoal/llms.txt Move a branch and all its descendants onto a different parent branch. This command is useful for reorganizing the structure of your branch stack. ```bash # Example usage for moving branches upstack (command not fully provided in source) ``` -------------------------------- ### Update Existing Pull Requests Only Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt stack submit --update-only` to only update existing pull requests for branches in the stack, without creating new ones. ```bash gt stack submit --update-only ``` -------------------------------- ### Fold Current Branch into Parent Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch fold` to merge the current branch's commits into its parent branch, effectively removing the current branch from the stack. ```bash gt branch fold ``` -------------------------------- ### Edit Downstack Order Interactively Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt downstack edit` to interactively reorder branches in the downstack (from trunk to current branch). This opens an editor similar to `git rebase interactive`. ```bash gt downstack edit ``` -------------------------------- ### Delete a Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch delete ` to delete a branch from the Charcoal stack and the local repository. ```bash gt branch delete old-branch ``` -------------------------------- ### Force Delete a Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch delete --force` to delete a branch even if it has not been merged. Use with caution. ```bash gt branch delete old-branch --force ``` -------------------------------- ### Move Current Branch onto Specific Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt upstack onto` to move the current branch onto a specified target branch. This command restacks the current branch and its ancestors onto the target branch. ```bash gt upstack onto main ``` -------------------------------- ### Squash All Commits in Current Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch squash` to squash all commits in the current branch into a single commit. This is useful for cleaning up history before merging. ```bash gt branch squash ``` -------------------------------- ### Rename Current Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch rename ` to rename the current branch. This updates the branch name locally and in the stack. ```bash gt branch rename new-name ``` -------------------------------- ### Untrack a Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch untrack ` to remove a branch from the Charcoal stack without deleting the local branch. ```bash gt branch untrack my-branch ``` -------------------------------- ### Force Rename Branch Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch rename --force` to rename a branch even if it has an associated open pull request. This may require manual updates to the PR. ```bash gt branch rename new-name --force ``` -------------------------------- ### Fold Branch Keeping Name Source: https://context7.com/danerwilliams/charcoal/llms.txt Use `gt branch fold --keep` to fold the current branch into its parent while retaining the current branch's name for the merged commits. ```bash gt branch fold --keep ``` -------------------------------- ### Restack Branches in Git Source: https://context7.com/danerwilliams/charcoal/llms.txt Rebase branches onto their parents when parent branches have been modified. This ensures all branches in a stack remain properly based on their dependencies. Supports restacking the current branch, the entire stack, or specific ranges. ```bash # Restack current branch only gt branch restack # Restack entire stack (all related branches) gt stack restack # Restack from current branch upward (all descendants) gt upstack restack # Restack from trunk to current branch (all ancestors) gt downstack restack # Restack from a specific branch gt stack restack --branch feature-branch # Shorthand aliases gt b r # branch restack gt s r # stack restack (also: gt s f, gt s fix) gt us r # upstack restack gt ds r # downstack restack ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.