Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
lxmcf204105y@ilikeglue @C0D4 yes... That would be the case if I hadn't already pushed the changes
-
C0D4681455y
-
Cybork10495yOr better yet,
git rebase -i HEAD~<number of commits>
This gives you lot's of control over the commit history, but you can edit every commit message in that upstream branch.
Then, do a git push --force -
git stash
git rebase -i
git stash pop
Commit messages should also be starting with a verb and be in present tense. Doesn't really matter but I think it looks a bit nicer -
Cybork10495y@ElCapitan question was not for me, but no. Force pushing is not necessarily a bad practice, it's more of a safeguard against accidentally fucking up the repo for everyone else...
But that what git reflog is for ❤️ -
@ElCapitan Well you should never force push. If you have already pushed then do another commit, else edit your local commits via rebase -i before pushing
-
Cybork10495y@12bitfloat if you never force push, you can't rebase your branch against master.
This leaves you with merge commits, a dirty and confusing history and the dissaproval of your peers. -
@Cybork You can rebase locally before pushing. If you have already pushed you might force push to clean it up but only if you know exactly what you're doing and nobody else is working on the branch
-
Cybork10495y@12bitfloat I push alot, the fear of an HD frying mid-work is real !
But yes, rule #1 of force pushing is know what you're doing, rule #2 is pulling main branch before -
@Cybork "nobody else is working on the branch" is the most important thing when force pushing. Pulling doesn't really matter if someone else has already cloned. That's how you corrupt the repo
-
C0D4681455yIf you have to force push, you are doing it wrong, why give yourself the headache of having to rebase the branch just because you don't give a shit about other people's work.
Now if it's a solo repo and your the only dev, do as you please - its only your code. If it's a team based repo it will eventually become a problem that will need to be corrected.
As for commit history beiNg messy, this is a pro and con of transparency.
After using git for all this time... I still can never commit changes correctly .-.
random