pharo-vcs / iceberg

Iceberg is the main toolset for handling VCS in Pharo.
MIT License
134 stars 85 forks source link

Force push option #540

Open jecisc opened 6 years ago

jecisc commented 6 years ago

When push fail because local branch is not in sync with the remote branch, we should have an option "Force push".

Probably, if we have this option, before pushing, we should have a warning dialog saying "This is a dangerous change that will rewrite the history of the remote branch. Do this action only if you are certain of what you are doing. Push anyway? Yes. No."

guillep commented 6 years ago

Well, in what case are you needing this? Because Iceberg should never let you get "out of sync".

The only way to arrive to such a case is that you were "cooking commits". For example rebasing, resetting hard a branch... But those operations are not possible from Iceberg's UI...

jecisc commented 6 years ago

IIRC I was working on a fix to Pharo on my laptop. But because of another Iceberg bug (trouble while commiting new package) the fix was not complet and I gave up.

Later I redone the fix from scratch on another computer. But then I had a local branch with a commit whose ancestor was the last commit on development branch and a branch present on github that I forgot to delete.

When I pushed from Iceberg I got an "out of synch" error. When I pushed from GitKraken I got a error saying that the local branch had conflict with the remote branch and asked if I wanted to force push.

guillep commented 6 years ago

Ah, so you restarted from scratch but you already had pushed some stuff (that you did not pull).

In general, forcing a push is not good (forcing is never good, always look for consentment :)). You could have fixed your problem also by deleting your remote branch first, which is a cleaner solution.

jecisc commented 6 years ago

I understand that most of the time we should not use this option. But sometimes it is useful when we know what we are doing. :)