mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-27 23:52:41 +01:00
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:
@@ -45,8 +45,8 @@ def test_not_match(command):
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, output', [
|
||||
(Command(script='git push', stderr=git_err), 'git push --force'),
|
||||
(Command(script='git push nvbn', stderr=git_err), 'git push --force nvbn'),
|
||||
(Command(script='git push nvbn master', stderr=git_err), 'git push --force nvbn master')])
|
||||
(Command(script='git push', stderr=git_err), 'git push --force-with-lease'),
|
||||
(Command(script='git push nvbn', stderr=git_err), 'git push --force-with-lease nvbn'),
|
||||
(Command(script='git push nvbn master', stderr=git_err), 'git push --force-with-lease nvbn master')])
|
||||
def test_get_new_command(command, output):
|
||||
assert get_new_command(command) == output
|
||||
|
Reference in New Issue
Block a user