ref: 1b1d9dd8049e73b4e6fe1b6305229af5a5fd54eb
parent: 46f5db52b9897e656cde27fa21930466d6920354
	author: mia soweli <mia@soweli.net>
	date: Sat Aug  9 14:10:47 EDT 2025
	
git/branch: don't clobber baseref when checking if we have an upstream branch if we assign baseref before checking if we already have the local branch, we end up querying for the branch at the origin. this is not fine if we are trying to switch to a local branch that is not present there.
--- a/sys/src/cmd/git/branch
+++ b/sys/src/cmd/git/branch
@@ -40,10 +40,11 @@
 if(~ $#newbr 0){if(! ~ $#baseref 0)
die update would clobber $branch with $baseref
-	baseref=`$nl{echo -n $new | sed s@refs/heads/@refs/remotes/origin/@}- if(! test -e .git/$new)
+	if(! test -e .git/$new){+		baseref=`$nl{echo -n $new | sed s@refs/heads/@refs/remotes/origin/@} 		if(! base=`{git/query $baseref})exit 'bad ref'
+ }
}
# figure out where we want the new branch to point to
--
⑨