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: 13
-
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, '22
jfo100% Agreed. Gitkraken should not contribute to work being lost on a branch if it does not need to.
-
11 May, '22
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, '22
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). -
17 Aug, '22
Egor HansAbsolute +1 for Nate's approach. Granted, not perfectly safe as Francis pointed out, but safe enough for most use cases. (And I'm pretty sure that Francis misunderstood this, thinking that Force with Lease would be the default even before the point of where a force push is necessary at all - which is not how this would be done.)
-
24 Oct, '22
Niklas ArensPlease just give us the option (e.g. like Nate describes). It doesn't need to be the default.
-
15 Nov, '22
Thomaspreferably force-with-lease as default force option.
I'm in favor of giving power to the end-user, but many people need to be protected from themselves.
an extra checkbox to check goes a long way in making people think. -
08 Dec, '22
Jake Stine--force-with-lease should be default. If nothing else, it would still solve the problem of the "window" where someone may have force-pushed new changes to a branch but GitKraken hasn't yet done it's own auto-fetch yet to surface that information to the user.
IMPORTANT: For maximum safety, GitKraken should block auto-fetch anytime a push dialog confirmation is displayed.
I'm of the opinion that a true "force push" isn't something a human should ever need to do. It's a tool that's generally best reserved for automated tools working within constrains where-in they can make safe assumptions that they intend to override the behavior of other automations (for sake of avoiding cascading failures). A human, however, can and should _always_ fetch to resolve a force-push failure. Therefore, --force-with-lease can and should be the default setting, and no option to use --force from a User Driven UI is necessary. (and force push from command line is easy to do) -
26 May
Ed EaglehouseA force push is usually necessary after a rebase. We only allow it on individual task branches, not release branches. I also saw a new --force-if-includes option, that is safer and may be a better default.
-
02 Aug
Trevor AdminForce push with lease is now available with the release of GitKraken Client 9.6.1!
Force push will now default to --force-with-lease with the Git Executable feature enabled. You will now be prompted to fetch or push --force (without lease) when the remote ref and remote-tracking branch are different.
The Git Executable feature represents our ongoing effort to transition from using NodeGit to using Git in order to bring more Git features like this to GitKraken Client. Once completed, GitKraken Client will exclusively use the Git Executable for Git actions.
For more details on the 9.6.1 release, visit our release notes: https://help.gitkraken.com/gitkraken-client/current/#version-9-6-1
For more details on the Git Executable feature, visit our help center: https://help.gitkraken.com/gitkraken-client/experimental-features/#git-executable
Thank you for taking the time to provide feedback! We appreciate your input as we continue to improve GitKraken Client.