New to Claude Skills? Learn how to install them →

microsoft on GitHub

Sync Changes

OfficialFree

Effortlessly sync your Git branches with upstream.

by microsoft188.6k stars on microsoft/vscode
1 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What Sync Changes does

Sync Changes is a skill designed for developers who need to manage their Git branches effectively. It automates the process of syncing the current session branch with its upstream branch or publishing the current session branch to a remote repository. This skill is particularly useful when you want to pull the latest changes from an upstream branch, rebase your work, push your commits, or set an upstream branch for your current session. By streamlining these actions, it helps maintain a clean and organized version control workflow.

The skill follows a structured workflow to ensure that all necessary checks are performed before executing Git commands. Initially, it checks for uncommitted changes and prompts the user to commit them if necessary. It then verifies whether the current branch has an upstream branch and fetches the latest updates from the remote repository. If the branch is behind, it automatically rebases the branch onto the upstream while handling any merge conflicts that may arise. This ensures that your local changes are integrated smoothly with the latest updates from the remote.

In cases where the current branch does not have an upstream branch, Sync Changes intelligently determines the appropriate remote to publish to, allowing for a seamless setup of upstream tracking. The skill also includes validation steps to confirm that the working tree is clean and that the sync state is accurate, providing users with confidence in their version control operations.

This skill is ideal for developers who regularly work with Git and need a reliable way to keep their branches in sync without manually executing multiple commands. It enhances productivity by automating common tasks and reducing the risk of errors during the syncing process.

When to use it

Use this skill when you need to sync your local branch with its upstream counterpart or publish a new branch to a remote repository.

When not to use it

This skill may not be suitable for users who prefer manual control over their Git operations or need to execute complex branching strategies.

What you can build with it

Syncing a Feature Branch

Use this skill to sync your feature branch with the latest changes from the main branch before merging.

Publishing a New Branch

When you create a new branch, this skill helps you publish it to the remote repository and set upstream tracking.

Resolving Merge Conflicts

If you encounter merge conflicts during a rebase, the skill assists in resolving them while preserving the intent of both changes.

How to install Sync Changes

View source

1. Install with the skills CLI

npx skills add microsoft/vscode/sync --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by microsoft
<!-- Customize this skill and select save to override its behavior. Delete that copy to restore the built-in behavior. -->

Sync Changes

Sync the current session branch with its upstream branch, or publish the current session branch to a remote. Use when the user asks to sync a branch, pull latest changes, rebase onto upstream, push current branch, publish branch, or set upstream.

Guidelines

  • Never force-push (--force, --force-with-lease) without explicit user approval.
  • Never skip pre-push hooks (do not use --no-verify).
  • Never rewrite or drop commits during rebase without asking the user.
  • When in doubt about conflict resolution — ask the user.

Workflow

  1. Check for uncommitted changes first. If there are uncommitted changes, use the /commit skill to commit them before continuing.
  2. Check whether the current session branch has an upstream branch.
  3. If the current session branch has an upstream branch: 3.1. Fetch the upstream remote first so tracking refs are up to date.
    git fetch <upstream-remote>
    
    3.2. Check ahead/behind counts. If the branch is already in sync (0 ahead, 0 behind), stop and report that no sync is needed.
    git rev-list --left-right --count HEAD...@{u}
    
    3.3. If behind, rebase onto the upstream tracking branch.
    git rebase @{u}
    
    3.4. If there are merge conflicts, resolve them by preserving the intent of both sides. Stage the resolved files and continue the rebase.
    git add <resolved-files>
    git rebase --continue
    
    If conflict resolution is unclear, ask the user how to proceed. If the user wants to stop the rebase, abort it:
    git rebase --abort
    
    3.5. If the branch has local commits (ahead > 0), push them to the remote after a successful rebase.
    git push
    
    If the push is rejected because the rebase rewrote history, explain the situation to the user and ask for approval before force-pushing.
  4. If the current session branch does not have an upstream branch: 4.1. Determine the remote to publish to.
    • If there is only one remote, use it.
    • If there are multiple remotes, use the #tool:vscode/askQuestions tool to ask which remote to use. 4.2. Publish the current branch and set upstream in one step.
    git push -u <remote> HEAD
    

Validation

After the workflow completes, validate the result with explicit checks:

  1. Verify the working tree is clean:
    git status --porcelain
    
  2. Verify sync state (ahead/behind counts are both 0):
    git rev-list --left-right --count HEAD...@{u}
    
  3. If the branch was newly published, verify the upstream branch is configured:
    git rev-parse --abbrev-ref --symbolic-full-name @{u}
    

Frequently asked questions about Sync Changes

Similar skills