Skip to content

Updating the git tree failed: Could not determine commit for "heads/v1.x" #89

@inmanturbo

Description

@inmanturbo

if you are comparing say main to v1.x and you then switch to v1.x and make a change then commit it, then switch back to main, your diff will still be compared to the old ref on v1.x.

Attempting to refresh with cause an error saying no such file or directory .git/packed-refs.

After running git pack-refs you will get the following error and will not be able to refresh or change base.

Updating the git tree failed: Could not determine commit for "heads/v1.x"

Steps:

echo "# first entry" > README.md  
git init
git add README.md
git branch -m main
git commit -m "first commit"
git tag v1.x 
git branch v1.x v1.x
echo "# second entry" >> README.md
git add README.md
git commit -m "second commit"

Open Git tree Compare select v1.x as base. See diff showing second commit.

Back in terminal, run

git switch v1.x
echo "# v1 patch" >> README.md  
git add README.md            
git commit -m "first patch"

switch back to main

git switch main

Your diff will not show the "v1 patch"
Attempt to refresh and see error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions