[Rock-dev] Force Pushes on GIT

Martin Günther martin.guenther at dfki.de
Wed Sep 27 10:15:59 CEST 2017


Dear all,


On 27.09.2017 09:09, Moritz Schilling wrote:
> Dear developers,
> 
> I want to ask you if you also experienced people force pushing to repositories and messing up the history. It happened recently to me with the drivers-orogen-camera_base repository. Fortunately, I had a clean local working copy with which I have been able to reconstruct the history.
> 
> I don't think that this is good practice and want to ask you also if we can maybe globally disable this kind of pushing method or at least restrict it to one/the maintainer only.

This definitely isn't good practice. It's the opposite of good practice
to force push to a "public" branch (i.e., branches that other people are
expected to check out, something like master or stable). Force pushing
to a feature branch where you're the only developer is ok IMO, but
ideally that branch should live in your private fork and not the
upstream repo.

I don't think there's a way to disable this globally. Both GitHub and
GitLab have "protected branches", which don't allow force pushing. In
GitLab the default branch is protected by default. You still have to
protect all other "public" branches manually.

On the other hand, I think in most cases it's probably not a technical
problem that requires a technical solution. Why did the developer force
push? Was it really an oversight (i.e., they didn't realize they were
pushing to master), or didn't they know they weren't supposed to do that?

Cheers,
Martin

P.S.: Pro tip: Don't use `git push --force`, always use `git push
--force-with-lease` instead, if you have to. This still has almost all
the problems of a force push, so don't use it on public branches.

-- 
Dipl.-Inf. Martin Günther
Researcher

DFKI GmbH
Robotics Innovation Center Bremen - Außenstelle Osnabrück
ICO InnovationsCentrum Osnabrück GmbH
Albert-Einstein-Straße 1
49076 Osnabrück, Germany

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5258 bytes
Desc: S/MIME Cryptographic Signature
Url : http://www.dfki.de/pipermail/rock-dev/attachments/20170927/e0258f37/attachment.bin 


More information about the Rock-dev mailing list