4 ms·
> You could use branches / tags for this purpose. Yeah that's what I meant by save them. > Reverts are not too bad becuase they are pretty meaningful. I was
by jonahx 4y ago
> You could use branches / tags for this purpose.
Yeah that's what I meant by save them.
> Reverts are not too bad becuase they are pretty meaningful.
I was responding to: "I still revert rather than reset and don't force push".
Say you are working privately on a branch, saving your work, etc. You realize you made a silly error, and need to undo a commit. Creating a revert commit here is a pretty serious error of git organization imo. Typically you do not want to save this work... it is just your private mess as you were working through the problem, and when you are done and have solved it, you want to save the final result, as clean history, perhaps as multiple commits, perhaps as one.
After you have published your work publicly, then yes, you need to do a revert commit if you made a mistake.
- quickthrower2 4y agoYou are right. There a times when, if I have a local-only branch and there is no utility in keeping the error I will reset. It is rare but it happens. If I went down a direction then tried something else, I prefer revert so I don't lose that. That said, tagging then resetting is probably just as good and might have the best of both worlds. You get to keep what you did and you keep the history clean. I only just thought of this now! Tagging and resetting is of course a bit like stash, but I see stashes as very temporary. It is easy to lost them due to stash pop.