this post was submitted on 06 Nov 2023
23 points (100.0% liked)

Git

2541 readers
10 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

I was curious about why people would run git push --force on a shared branch. Some reasons people gave were:

  • they’re working on a collaborative feature branch, and the feature branch needs to be rebased onto main. The idea here is that you’re just really careful about coordinating the rebase so nothing gets lost.

A safer solution would be to make a new branch and do the rebase on it instead, that way the shared branch won't be impacted. You might still lose changes if they're pushed after merging to main but that's not really rebases fault. You can always cherry pick or something then from the original un-rebased branch (hopefully without any merge issues...)