GitSavvy Documentation

repository·master·Indexed 24 days ago

https://github.com/timbrel/gitsavvy

A powerful Git plugin for Sublime Text (version 3 and above) that provides advanced functionalities including visual history, rebasing, diffing, and line history. It features GitHub integration for PRs and commit references, a specialized blame view, and tools for git bisect and fixup/squash operations. Requires Git 2.18.0 or greater.

Tokens
40.7K
Snippets
47
Records
310
Agent score
83%

What's inside GitSavvy

  1. Use interpolation in custom Git arguments

    master

    When defining the args array for a gs_custom command, you can use specific placeholder strings that GitSavvy will automatically substitute at runtime:

    • {FILE_PATH}: The path to the currently opened file.
    • {REPO_PATH}: The path to the repository of the currently opened file.
    • {PROMPT_ARG}: Triggers a user prompt. The text of this prompt is determined by the prompt_msg configuration key.
  2. View GitHub-style Blame

    master
    GitSavvy offers a blame view that displays hunk metadata, allowing you to see the commit that introduced a specific change, mimicking the GitHub interface. In file-at-commit views, pressing [b] opens the blame for that specific revision at the current visible position.
  3. Use Fixup and Squash Helpers

    master
    GitSavvy includes helpers to perform fixup and squash operations. These can be accessed from various views, including the Line History view, to streamline the process of cleaning up commit histories.
  4. Use the Rebase dashboard to manipulate commits

    master

    The Rebase dashboard allows you to manage the history of your current branch by re-ordering, squashing, or editing commits.

    Important Constraints:

    • You cannot manipulate commits if the current branch is not connected to a base-ref. You must select a base-ref or perform a rebase first.
    • Most manipulation commands (squashing, moving, editing) cannot be performed while a rebase operation is currently in progress.
  5. Use the Repo History View

    master

    The Repo History view is a central hub for Git operations. Key interactions include:

    • Navigation: Use [n] and [p] to walk the reflog (useful for checking or undoing a rebase).
    • Filtering: Use [s] to hide all commits and view only branches and tags. Use [ctrl+r] to search and select a branch or tag.
    • Commit Details: Position the cursor on a commit and press [o] to see the full commit/patch. Use [p] and [n] to walk the history.
    • Editing: Use [W] to reWord a commit message.
    • Diffing: Select two commits with [space] and press [enter] to open a diff between them.
    • Rebasing: Use [r] to open the rebase menu. If you have fixup or squash commits, the rebase menu provides specific actions to apply them to their associated commits.
  6. How DeferrableTestCase and generators work in tests

    master

    GitSavvy uses DeferrableTestCase for its unit tests, which are executed by the DeferringTextTestRunner. This runner supports using Python generators as test functions to handle asynchronous-style waiting or conditional polling.

    When a test function is a generator, the runner behaves based on the yielded object:

    • Yielding a callable: The runner evaluates the callable. If it returns True, the generator continues immediately. If it returns False, the runner waits until the condition becomes True.
    • Yielding an integer (x): The runner pauses the generator for x milliseconds before continuing.
    • Yielding anything else: The runner pauses the generator for a default of 10 ms.
  7. Manage changes with Git Diff View

    master

    The git diff view in GitSavvy allows you to manipulate your current working state by staging, unstaging, or resetting (discarding) changes at multiple granularities:

    • Files
    • Hunks
    • Individual lines
  8. Create a stash from staged changes only

    master
    Use the git: stash save staged changes only command to create a stash containing only your staged changes. This is achieved by stashing unstaged files first, then stashing all files and popping the initial stash to isolate the staged state.
    git: stash save staged changes only
  9. Finish a feature, release, hotfix, or support branch

    master

    Use the flow: feature/release/hotfix/support finish command to complete a branch lifecycle.

    • If the relevant branch is currently checked out, you will be asked to confirm the finish.
    • If it is not checked out, you will be prompted to select the branch you wish to finish.

    This command merges the changes from the target branch into the develop branch (performing a non-fast-forward merge unless the branch contains only a single commit).

  10. View and export recorded debug logs

    master
    After recording a sequence of Git commands, use the GitSavvy: view recorded log command. This will open the recorded log in a new Sublime Text scratch view in JSON format. You can then save this file to provide it when reporting issues.
    GitSavvy: view recorded log
  11. Publish a feature, release, or hotfix branch

    master

    Use the flow: feature/release/hotfix publish command to push a branch to its configured remote.

    • If the branch is currently checked out, you will be asked to confirm the publish.
    • If it is not checked out, you will be prompted to select the relevant branch.

    This action pushes the target branch to the configured remote.

  12. Create a stash with `git: stash save`

    master
    Use the git: stash save command to create a new stash of your current changes. For commands that require selecting a specific stash, GitSavvy will open a panel to allow you to pick which stash to action on.
    git: stash save