Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

How to support push --force-with-lease but not git push --force?

We have the Reject Force Push hook turned on in our Bitbucket server which is a godsend for most situations but it prevents a real need which is rebasing a topic branch that is undergoing code review in a PR.   For example you might want to:

  • Interactively rebase, squashing commits, fixing commit messages, etc.
  • Rebase --onto another branch.

Let's focus on the first use case because that would be possible with --force-with-lease.  (It expects the remote ref to be the same as on the tracking branch, and that wouldn't be the case with rebase --onto).

Can a server-side hook tell if a push is --force-with-lease vs. --force?  If so then it would be an easy modification to the existing hook.  If not then we would need to use an addon like Control Freak which can let you allow push --force for certain branch types but not others.

 

1 answer

1 accepted

0 votes
Answer accepted

 

Hi,

I maintain Control Freak so I'm very familiar with this problem.

Unfortunately there is no way to detect "--force-with-lease" on the server side.  The logic behind "--force-with-lease" is based on data only available to the git client.  The server does not have this data and so it cannot tell the difference between regular "--force" and "--force-with-lease".  On the server side those pushes are indistinguishable.

The git server does not track every time every possible git client has run "git pull" or "git fetch"  - that's the data the server would need if it wanted to implement this.

Thanks Sylvie.  That's what I figured but I wanted to verify. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
6.3.6
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

485 views 5 4
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