Git从其他分支创建分支遇异常:Bitbucket父分支显示问题求助
feature-new-feature Hey Albert, sorry to hear you're stuck with this parent branch display glitch in Bitbucket after setting up your new feature branch. Let's walk through what might be going on and how to fix it:
Possible Causes & Step-by-Step Fixes
1. Your local feature-kernel branch was out of sync when creating the new branch
If you made feature-new-feature from a local feature-kernel that didn't have the latest commits from the remote, Bitbucket might fail to recognize the correct parent relationship. Here's how to resolve this:
- First, sync your local
feature-kernelwith the remote:git checkout feature-kernel git pull origin feature-kernel - If you haven't made any commits to
feature-new-featureyet, recreate it and push again:
Note: Only usegit checkout -b feature-new-feature feature-kernel git push --force --set-upstream origin feature-new-feature--forceif you're certain the remotefeature-new-featurehas no unsaved work—this will overwrite the remote branch.
2. Bitbucket's UI is caching outdated branch data
Sometimes Bitbucket's branch page doesn't refresh immediately with the correct parent info. Try these quick checks:
- Hard-refresh your browser (Ctrl+F5 on Windows/Linux, Cmd+Shift+R on Mac) to clear local cache.
- Wait 5-10 minutes—Bitbucket occasionally needs time to process and display branch relationships properly.
- Navigate to the commit history page for
feature-new-featurein Bitbucket; viewing the commit chain often triggers a refresh of the parent branch metadata.
3. Confirm your local branch's parent relationship is correct
Before blaming Bitbucket, make sure your local branch is actually rooted in feature-kernel:
- Run this command to visualize the branch history:
You should seegit log --oneline --graph feature-new-feature feature-kernelfeature-new-featurebranching directly from the latest commit offeature-kernel. If not, your local branch was created from the wrong starting point, and you'll need to recreate it as outlined in step 1.
4. Force Bitbucket to reindex the branch
If nothing else works, deleting and recreating the remote branch will trigger a full reindex:
- First, remove the remote branch:
git push origin --delete feature-new-feature - Push your local
feature-new-featurebranch again:
This makes Bitbucket reprocess the branch's parent relationship from scratch.git push --set-upstream origin feature-new-feature
内容的提问来源于stack exchange,提问作者Albert

