Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

"Reject Force Push" hook for master branch only

Deleted user Apr 22, 2013

I was wondering whether there was a way to reject force push on the master branch only.

This is so developers can work on feature branches, push, rebase & force push as necessary before a code reviewer merges into master.

5 answers

1 accepted

4 votes
Answer accepted

I believe this has finally been added in Stash 3.10 :

Hi Chris,

I'm afraid there isn't really a way at the moment. You could certainly add your own custom plugin to do just that. Otherwise you might be interested in this feature reques, which you should vote on:



Deleted user Apr 22, 2013

Thanks for the quick response! I guess a custom plugin might be the way to go. Do you know if the code is hosted somewhere?

I found this ( but I don't think that's the one used in Stash?

Hi Chris,

I'm afraid our code is currently private, although honestly it looks almost identical to out code _plus_ it has a branch selector. That would be a good starting point, and if you just want one branch to restrict then it should probably work out of the box.



Deleted user Apr 22, 2013

Ahh cool - sorry I only just had a moment to look at the code - thanks!

curious if this change is completed [restrict force push to master but allow force push on branches] is deleted back in April. Anyone know why, or if there is a replacement? I still have a copy of it locally, will republish if needed. (Though I suspect it might be broken on Stash 3.1 ... still investigating that.)

You can download the plugin from the marketplace, I do keep it up to date with the latest Stash releases. Let me know if you run into any problems.

Rally nice plugin Carolyn!! We tried it and it works nicely! You shoud add the link as an answer to this question instead of just a comment, it may be easily missed otherwise.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,926 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you