4 ms·
Nice overview. There is a lot of rebasing going on, and I wonder how that would work when more than one person works on the downstream fork. Force-pushing can e
by rahkiin 2y ago
Nice overview. There is a lot of rebasing going on, and I wonder how that would work when more than one person works on the downstream fork. Force-pushing can easily break other users’ checkouts.
- hmottestad 2y agoRule of thumb is: - never force push a branch - at least not if someone else could be working on it - and definitely not without talking to them about it Personally I force push my branches quite often. It's super useful to rebase my branch on to main/master or doing an interactive rebase to reorder my commits, merge or just change the commit message. I've been on the other end of someone rebasing and force pushing. I've found that just removing the branch from my local git and then checking it out fresh from origin is the simplest way to go.
- argulane 2y agoYou can also `git fetch` and `git reset --hard origin/force-pushed-branch` to get your local branch up to speed with remote one assuming you don't have any local changes.
- wsc981 2y agoAnd if you do have changes, can create a new (temp) branch from diverged, reset the diverged branch to origin and cherry pick your own commits on top.
- keybored 2y agoWith a “branch” you’re often talking about the same repository (as in you can push to the same repository). With “forks” there might be N different “trees” where each tree is “mine” and the coordination could be patches via emails. With such a loose relation you could easily end up in a situation where you are conceptually “force pushing”. Because you might use the same patches but not have the same graph topology. What if you send three patches to the upstream and they incorporate it with git-am(1)? Then they have effectively made a different history with your patches: three commits which are not the same as your three but may be patch-identical. Then you need to keep track of that “force push” by the upstream so that you don’t maintain your now duplicate commits (as in distinct commits but the changes are duplicates).
- keybored 2y agoPeople in OSS often talk about “maintaining patches” on top of an upstream. That’s rebase in another guise.