4 ms·
This. Maybe even more than 99% of the time you are fine. It's okay to struggle a day with a rare problem every now and then. Just don't be scared of it. There a
by dailykoder 2y ago
This. Maybe even more than 99% of the time you are fine. It's okay to struggle a day with a rare problem every now and then. Just don't be scared of it. There are enough resources out there to research them when you need them.
Where I still get nervous is when I force push my branch after a rebase, even if I know I am the only one working on it. But this is also one of these examples. If I remember correctly, there are other options to sync your remote after you did a rebase, but force push is just the easiest. So I rather take 5 seconds to make sure I typed exactly what I wanted and that everything is fine and that just works.
Edit: I was just brainstorming a bit about it and thought that probably some of the unknown magic git features were just implemented by a motivated dev that just wanted to explore what's possible. But on the other hand, there are most likely some very very obscure configurations and edge cases in the wild where people actually need those features. But most people will likely never need them, so I myself won't bother understanding "everything"
- osigurdson 2y agoAgree. It only makes sense to be scared of it if direct pushes to master are allowed - that would be crazy. This + avoid long running branches and there isn't much to fear.
- dylan604 2y ago[flagged]
- milesrout 2y ago>Where I still get nervous is when I force push my branch after a rebase, even if I know I am the only one working on it. It sounds like you recognise that this is an irrational fear but in case you don't: this is an irrational fear.
- rectang 2y agoI agree that it won't cause collaboration issues. Perhaps the fear arises because force pushing destroys your backup, so to speak? I freed myself from the fear of losing data after a rebase when I learned to restore from a commit in `git reflog`. So long as your work made it into an actual commit at some point, everything is recoverable from the local repo's history[1]. [1] Ignoring giganto repos that actually trigger garbage collection.
- fragmede 2y agoyou could do git checkout -b backup-of-branch-foo and push that, before force pushing branch-foo, for the paranoid