snippets/old_snippets/git-force-push-with-lease.en.md

26 lines
No EOL
708 B
Markdown

---
title: "force push with --lease for safety"
date: 2020-06-10T10:06:23+02:00
draft: false
snippet_types: ["git"]
---
Just found out, via [tweet](https://twitter.com/joshdholtz/status/1270578433563787264?s=19), from
the insightful [joshdholtz](https://twitter.com/joshdholtz) that there is a safer alternative to
`git push --force`
Time to update my aliases:
```diff
alias gs="gst"
-alias gpf="gp --force"
+alias gpf="gp --force-with-lease"
alias gdc="gd --cached"
```
*I use zsh shell's git plugin that is why you see "gst" for `git status` and "gp" for `git push`. Highly recommend it*
**Source:**
- [stackoverflow](https://stackoverflow.com/questions/52823692/git-push-force-with-lease-vs-force)