Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can Sourcetree or Bitbucket prevent merging develop into a local branch?

Mike Purrington
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 16, 2024

Is there a setting or hack to configure Sourcetree to not allow the client to merge the Develop branch into a local working branch?  We have an ongoing issue with developers "tainting" their local branch by pulling the Develop branch into it mid-cycle.  Ideally, I'd like to make it so that the Develop branch is locked and the only thing you can do is branch it. 

FWIW - Bitbucket is our repository - but I suspect this is outside the realm of the repository since the method it uses to enforce pull requests is by preventing pushes, which wouldn't be possible for a working branch. 

1 answer

0 votes
Martin Runge
Community Champion
April 28, 2026

Hi @Mike Purrington 

Welcome to the Atlassian community!

In brief, Sourcetree doesn't feature a "lock" option to stop local merges because that function is mainly managed by Git's core system on your device.

However, you have two solid ways to manage this:

  1. You can use a pre-merge-commit hook in your local repository. This script can check the name of the branch being merged and "exit with an error" if someone tries to merge develop into a restricted local branch.
  2. As you suspected, Bitbucket handles this via Branch Permissions. While this won't stop them from merging locally, it will stop them from pushing those "tainted" commits to the server.

If "tainting" the local branch is the main concern, a Git Hook is your best bet for a "hard stop" on the client side.

Cheers,
Martin

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events