Add force option --force-with-lease
Git push --force overwrites a remote branch with your local branch.
Git push --force-with-lease is a safer option that will not overwrite any work on the remote branch if more commits were added to the remote branch (by another team-member or coworker or what have you). It ensures you do not overwrite someone elses work by force pushing.
As a user, I want GitKraken to support using --force-with-lease with a checkbox.
Comments: 7
-
25 Jun, '21
Max MoldmannForce with lease could be the default behavior. Only when it fails GitKraken could ask if you still want to do a Force push.
-
24 Nov, '21
Matteo ContriExactly like "pull" that has multiple choices, "push" should have "force" and "force-with-lease"
-
25 Nov, '21
Ryan AtwoodThis would be immensely helpful given the way we use git on our team
-
22 Dec, '21
NaufalAgreed with Matteo's suggestion, have "push" with a drop-down option in the gui.
-
19 Jan
jfo100% Agreed. Gitkraken should not contribute to work being lost on a branch if it does not need to.
-
11 May
Nate HartPlease add this! You could add it as another button in the force dialog:
1. I push a rebased commit
2. Popup has a "Force Push With Lease" option
ex. 'feature/foo' is behind 'origin/feature/foo'. Update your branch by doing a pull. [Pull (fast forward if possible)] [Force Push] [Force Push With Lease] [Cancel]
3. Now we are safe! -
18 May
FrancisForce with lease is not _always_ safe. See https://stackoverflow.com/questions/59309402/is-git-push-force-with-lease-always-safe
Especially since GitKraken continually does `git fetch` in the background, using lease will often give a false sense of security because the local remote has already been updated to match the actual remote. Using it by default for all pushed would be a bad idea.
What I'd like to see some work to streamline the rebase workflow - right now, a rebase always requires clicking the scary red "Force Push" button to update the remote branch. Junior devs always screw this up at first.
I think the proper fix would be an option to change the default Push mode to use `--force-with-lease --force-if-includes` which I _think_ should be safe (needs some experimentation).