Skip to Main Content
TWIL
git
Image of Emily demonstrating the concept of Force Push with Lease in Git, symbolizing the secure and collaborative management of code repositories.

Welcome to "TWIL," the weekly digest where we distill the latest insights our team has gathered on complex topics into bite-sized teachable moments. This week, Emily dissects the safe execution of Force Push with Lease in Git, bringing clarity to how developers can ensure their repository contributions are respected and protected. Join us to discover how careful use of force push can maintain harmony within your codebase.

Force Push with Lease

TLDR; Force push over your own commits, not other people's!

Add to your gitconfig

[alias]
    pf = push --force-with-lease

and then use with:

# instead of
git push --force-with-lease origin feature-branch

# use
git pf feature-branch

Resources

  • Git
Emily Morehouse's profile picture
Emily Morehouse

Cofounder, Director of Engineering

Related Posts

Digital pioneer journeying through technological quirks, reminiscent of vast waterfalls and rocky terrains
April 5, 2017 • Kyle Misencik

Infinitely dispatching actions + React, Redux & React Router v4

While implementing JWT for an application, we ran into a quirk with React Router v4. Here, we hope to show how to implement protected client-side routes while avoiding some of the pitfalls we encountered.

Turtle swimming close to a life preserver as a metaphor for developers using Git version management to stay afloat
May 4, 2017 • Nick Farrell

Life-Saving Git Tips

From salvaging lost commits to streamlining your workflow, discover how to make your coding life smoother and avoid common pitfalls.