20

I feel that I'm using
git push --force
too much.

Anybody else feels this way too?

Comments
  • 9
    Sometimes it's good to use
    git push --gently
    Life is short.
  • 5
    Never used force. I heard it's bad 😄
  • 3
    Depends how fucked up your work colleagues are
  • 9
    did anyone say gitpush?
  • 1
    You may want to consider using --force-with-lease. I have used --force a lot too but was always a bit worried to accidentally override something. -with-lease is definitely a better choice as it checks remote changes first
  • 1
    It's not a big deal if you're the only contributor.
  • 3
    In some git workflows, it's normal. If you always rebase your stuff, it happens a lot; if you merge everything and still pushes with force, then something might be wrong.
  • 2
    @dread-uo Yea, I’m currently taking a software engineering module in school, and as you can guess, groupmates aren’t familiar with git workflow.

    So mistakes were made and git push —force was used to clean up mistakes... a shit ton of them.

    The alternative would be to have half of the team repo commits be for correcting checkstyle
  • 2
    You are NOT supposed to use it regardless of the workflow. It basically means: Remote server, your history is bad, take mine. In the worst case scenario you are obliterating other people's commits.
  • 1
    Sounds like an issue with your git workflow more than anything else, really. I started using feature branches in my multi-person side projects and have never had to —force since.
  • 2
    How the fuck can you people use --force so regularly without feeling bad about it?

    I only use it on the occasion when my boss or the intern fucks up the repo an I have to clean up the mess. 😉
  • 2
    @jclin95 just make the master branch protected so only you or some other competent person can accept merge requests on it or directly push.
  • 2
    never needed to use it either. never needed a rebase too. merge often and do decent reviews on merge/pull requests, don't let untested code going entirely through your pipeline. and then you are almost safe 😉
  • 1
    I use git for years and never used --force.
  • 0
    @vesper srsly, you never used it's full potential of screwing up things! You should try it! It's life changing!
  • 0
    I worked once with a workflow where there weren't any merge commits on git history, and we always rebased our code. I like that workflow, but it demands some care with rebasing and force pushing.
Add Comment