Use --force-with-lease instead of --force for git push

--force flag can be very dangerous, because it unconditionally
overwrites remote branch - if someone pushed new commits to the remote
repo after you last fetched/pulled, and you do push --force, you will
overwrite his commits without even knowing that you did that.  Using
--force-with-lease is much safer because it only overwrites remote
branch when it points to the same commit that you think it points to.

Read more:
https://developer.atlassian.com/blog/2015/04/force-with-lease/
This commit is contained in:
Jan Warchoł
2015-10-30 16:17:56 +01:00
parent 959b96cf6e
commit dc23d67a42
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -219,7 +219,7 @@ Enabled by default only on specific platforms:
Bundled, but not enabled by default:
* `git_push_force` – adds `--force` to a `git push` (may conflict with `git_push_pull`);
* `git_push_force` – adds `--force-with-lease` to a `git push` (may conflict with `git_push_pull`);
* `rm_root` – adds `--no-preserve-root` to `rm -rf /` command.
## Creating your own rules