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

Image from the "TWIL" blog post showing how Firebase tools integrate with JavaScript and React-Native for app development.
October 29, 2019 • Frank Valcarcel

TWIL 2019-10-25

Join us for this week’s “TWIL” where Marisa guides us on how Firebase’s Firestore, Storage, and Cloud Functions work in unison with JavaScript and React-Native to update documents in real-time applications.

Illustration of Marisa demonstrating the process of Checking Out Pull Requests from Forked Remotes in Git, symbolizing the swift integration of important updates into a project's workflow.
July 17, 2019 • Frank Valcarcel

TWIL 2019-07-12

Dive into this week’s TWIL with Marisa to discover the a method to efficiently checkout and incorporate changes, even before they’re officially merged upstream.