Phabricator是否支持项目分支?寻求摆脱Bitbucket依赖的方案
Hey there, let's tackle your two main concerns: getting branch functionality working in Phabricator, and breaking its dependency on Bitbucket so your project stays safe even if Bitbucket goes away.
1. First: Enabling Branch Support in Phabricator
Phabricator absolutely supports Git branches—you just might be looking in the wrong place if you were using a Bitbucket-linked repo. Here's how to access and manage branches properly:
- If you switch to an independent Phabricator repo (more on that below), navigate to your repo's page in Phabricator. Look for the Branches tab in the left-hand menu—this will show all branches pushed directly to Phabricator.
- For local workflow, use standard Git commands to create branches (
git checkout -b new-feature), then push them to Phabricator withgit push origin new-feature. You can also use Phabricator's command-line toolarcto manage branches witharc branch(it syncs seamlessly with Phabricator's web UI).
2. Breaking Phabricator's Dependency on Bitbucket
To make Phabricator your primary, independent repo (so Bitbucket's fate doesn't affect it), follow these steps:
Step 1: Create a fresh independent repo in Phabricator
- Go to Phabricator's Repositories section, click Create Repository, and choose Git as the type.
- Skip any options to link to external services (like Bitbucket)—this will be a standalone repo hosted directly in Phabricator.
Step 2: Mirror your entire Bitbucket repo (including all branches) to Phabricator
- Clone a complete mirror of your Bitbucket repo locally to capture all branches, tags, and full commit history:
git clone --mirror <your-bitbucket-repo-url> - Navigate into the cloned mirror folder, then push everything to your new Phabricator repo:
cd <repo-name>.git git push --mirror <your-phabricator-repo-url>
This copies every piece of your codebase to Phabricator—now it has a full, independent copy that doesn't rely on Bitbucket.
Step 3: Update your local dev environment
- For each local working copy, switch the primary remote to Phabricator:
git remote set-url origin <your-phabricator-repo-url> - If you still want to keep Bitbucket as a backup/mirror, add it as a secondary remote:
git remote add bitbucket <your-bitbucket-repo-url>
Step 4: Adjust your workflow to use Phabricator directly
- Use
arc diffto send local commits to Phabricator for code review (no need to push to Bitbucket first). - Once reviews are approved, use
arc landto merge your branch into the main branch directly in Phabricator.
Optional: Set up sync to Bitbucket (if needed)
If you still want Bitbucket to have a copy, you can set up a post-receive hook in Phabricator that automatically pushes changes to Bitbucket. This way, Bitbucket becomes the secondary mirror, not the source—so if it's deleted, your main repo in Phabricator remains completely intact.
Final Notes
- Always keep backups of your Phabricator repo (you can run periodic
git clone --mirrorto a local server or cloud storage). - Double-check that all branches are visible in Phabricator's Branches tab after pushing the mirror—if any are missing, re-run the
git push --mirrorcommand to ensure nothing was skipped.
内容的提问来源于stack exchange,提问作者Himanshu Sharma

