Software⏱️ 3 min read📅 2026-06-03

How to Fix: "Cannot update paths and switch to branch at the same time"

Git error when creating a new branch and setting up tracking simultaneously.

Quick Answer: The issue arises because the `--track` option is used to set up tracking, which Git considers as updating paths. To resolve this, use `git checkout -b test --track origin/master` instead of `git checkout -b test --track`.

The error 'Cannot update paths and switch to branch at the same time' occurs when you attempt to create a new branch using `git checkout -b` while simultaneously updating the tracking information with `--track origin/master`. This issue typically affects users who are familiar with Git's branching workflow, making it frustrating to resolve.

This error is often caused by Git's internal conflict resolution mechanism, which prevents simultaneous updates to branches and paths. The primary reason for this restriction is to maintain a consistent state of the repository and prevent unintended changes.

💡 Why You Are Getting This Error

  • The root cause of this issue lies in Git's design philosophy, which prioritizes atomicity over concurrent operations. When you use `git checkout -b`, Git creates a new branch and checks it out simultaneously. However, when you add the `--track origin/master` option, Git attempts to update the tracking information while the branch is being checked out. This creates a conflict that cannot be resolved because Git cannot determine which operation should take precedence.
  • Another possible cause of this issue is an incorrect or incomplete repository configuration. If the remote repository is not properly configured or if there are issues with the network connection, it may lead to conflicts when attempting to update paths and switch branches simultaneously.

🚀 How to Resolve This Issue

Resolving Conflicts by Redoing the Checkout

  1. Step 1: First, remove the tracking information using `git branch --unset-upstream test`. This step will help Git resolve any existing conflicts.
  2. Step 2: Next, create a new branch using `git checkout -b test` without the `--track origin/master` option. Once you've created the branch, you can add the tracking information again using `git branch --set-upstream-to=origin/test`.

Resolving Conflicts by Using Git's Interactive Mode

  1. Step 1: Use the interactive mode to resolve conflicts manually. Start a new repository and create a new branch using `git checkout -b test`. Then, navigate to the branch directory and run `git status` to identify any conflicts.
  2. Step 2: Manually resolve the conflicts by running `git add ` or `git commit -m ''` for each file that needs changes. Once all conflicts are resolved, use `git push --force-with-lease` to update the remote repository.

✨ Wrapping Up

To resolve the 'Cannot update paths and switch to branch at the same time' error, you can try one of two methods: Redoing the checkout by removing tracking information and re-adding it later, or using Git's interactive mode to manually resolve conflicts. By following these steps, you should be able to successfully create a new branch while updating tracking information.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions