Skip to content

zaknafeyn/git-smart-checkout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-smart-checkout

Website: https://git-smart-checkout.vradchuk.info

License: MIT VS Marketplace Open VSX

Requirements

  • Git 2.38 or newer (required for conflict pre-flight detection in auto stash and pop/apply modes)

Info

git-smart-checkout is a VS Code extension that adds stash-aware Git commands to the command palette. It helps you switch branches, pull, rebase, clone PR changes, and create tags without manually juggling local changes.

Comments and contributions are very welcome!

Motivation

In fast-paced development environments, switching between Git branches is frequent but often disruptive. Developers may have uncommitted changes that block a checkout, leading to tedious manual stashing and the risk of losing or misplacing changes. This friction interrupts focus, breaks workflow, and slows down productivity.

git-smart-checkout eliminates that pain by automatically stashing and restoring changes around common Git operations. You can stay in flow, move confidently between tasks, and avoid the familiar "local changes would be overwritten" detour.

Features

Feature Command Details
Checkout to a branch, tag, or remote ref with configurable stash behavior Git Smart Checkout: Checkout to ... (With Stash) Checkout with stash
Checkout the previous branch with the same stash behavior Git Smart Checkout: Checkout previous branch (With Stash) Checkout previous branch with stash
Checkout a GitHub pull request branch by PR number or URL Git Smart Checkout: Checkout by PR number... (With Stash) Checkout by PR number with stash
Review a GitHub pull request in a linked worktree and remove tracked review worktrees Git Smart Checkout: PR Review in Worktree, Git Smart Checkout: Remove PR review in Worktree PR review in worktree
Pull the current branch while preserving local changes Git Smart Checkout: Pull (With Stash) Pull with stash
Pull with rebase while preserving local changes Git Smart Checkout: Pull (Rebase With Stash) Pull rebase with stash
Rebase the current branch onto another ref while preserving local changes Git Smart Checkout: Rebase ... (With Stash) Rebase with stash
Copy staged or WIP changes between existing worktrees Git Smart Checkout: Copy staged changes to worktree ..., Git Smart Checkout: Copy WIP changes to worktree ..., Git Smart Checkout: Copy WIP from Worktree, Git Smart Checkout: Move WIP from Worktree Copy changes to worktree
Create a new PR from selected commits in another GitHub PR Git Smart Checkout: Clone pull request... GitHub PR clone
Generate and optionally push a tag from a reusable template Git Smart Checkout: Create Tag from Template Create tag from template
Change the default stash mode used by checkout-style commands Git Smart Checkout: Switch Mode Switch mode

Extension Settings

Click a setting ID to open that setting in VS Code.

Settings.id (Name) Type Description
⚙️ git-smart-checkout.mode (Checkout stash mode) string Default checkout stash mode. Available values: manual, autoStashForBranch, autoStashAndPop, autoStashAndApply.
⚙️ git-smart-checkout.logging.enabled (Logging enabled) boolean Enables the extension logging output.
⚙️ git-smart-checkout.refetchBeforeCheckout (Refetch before checkout) boolean Refetches remotes before each checkout.
⚙️ git-smart-checkout.useFastBranchList (Use fast branch list) boolean Seeds the branch picker from VS Code's cached Git model, then enriches it with full details in the background. Disable if the picker shows stale branches.
⚙️ git-smart-checkout.defaultTargetBranch (Default target branch) string Default target branch for PR cloning. Leave empty to use the first available branch.
⚙️ git-smart-checkout.defaultWorktreeDirectory (Default worktree directory) string Directory where PR clone temporary worktrees are created. Leave empty to create them one level up from the current repository.
⚙️ git-smart-checkout.prBranchPrefix (PR branch prefix) string Prefix added to PR clone branch names. If the prefix does not end with a slash, one is added automatically.
⚙️ git-smart-checkout.showStatusBar (Show status bar) boolean Shows the extension status bar item.
⚙️ git-smart-checkout.useInPlaceCherryPick (Use in-place cherry-pick) boolean Uses in-place cherry-pick instead of a temporary worktree for PR cloning. This works best when cherry-pick conflicts are not expected.
⚙️ git-smart-checkout.preferredRefs (Preferred refs) object Per-user map of preferred refs by repository. Keys are <owner>/<repo> or workspace folder names; values contain locals, remotes, and tags arrays with full ref names.
⚙️ git-smart-checkout.tagTemplate (Tag template) string Template used to generate Git tag names. Supports {f:<file>:<json-path>}, {b:<regex>}, {r:<start-number>}, {s:<script>}, and {s:stderr:<script>} tokens.
⚙️ git-smart-checkout.pushTagWithoutConfirmation (Push tag without confirmation) boolean Pushes the created Git tag to the remote without asking for confirmation.
⚙️ git-smart-checkout.tagRemote (Tag remote) string Git remote used when pushing created tags.
⚙️ git-smart-checkout.telemetry.enabled (Telemetry enabled) boolean Enables anonymous Git Smart Checkout analytics while respecting VS Code's global telemetry settings.

Telemetry

This extension collects anonymous usage events to help improve the extension.

Collected:

  • Extension activation
  • Command usage (checkout, pull, rebase, tag creation, PR clone)
  • Stash mode used during checkout and rebase commands
  • Whether the working directory had uncommitted changes (boolean)
  • Whether copy/move worktree commands copied staged/WIP changes, whether the target had local changes, included untracked files, and how many untracked files were copied
  • Whether PR review worktree removal stashed changes before removal
  • Commit count for PR clone operations (number only)
  • Whether a PR was created as a draft (boolean)
  • Whether a tag template was used (boolean)
  • Non-sensitive error type names (for example, TypeError or Error)
  • VS Code version
  • Extension version
  • Operating system (platform, for example, darwin, win32, or linux)

Not collected:

  • Source code
  • File contents
  • File paths
  • Repository names
  • Branch names
  • Tag names
  • Commit messages
  • PR numbers or titles
  • Remote URLs
  • Personal information

Telemetry respects VS Code's global telemetry setting and can be disabled with:

"telemetry.telemetryLevel": "off"

You can also disable extension telemetry independently with:

"git-smart-checkout.telemetry.enabled": false

About

Automatically stash and restore changes at checkout a branch

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors