3 ms·
There is something wrong with your workflow if you have to use git reset --hard nearly every day.
by kyberias 7y ago
There is something wrong with your workflow if you have to use git reset --hard nearly every day.
- jedberg 7y agoWhy in the world would you say that? I check out a branch, I write some code, it doesn't do what I want, I do a git reset and try again. If you aren't using git reset that means you're either a genius coder who doesn't make mistakes, or you are a coder who would rather keep going down a bad path instead of just starting fresh. Some people find it easier to just start fresh.
- claytonjy 7y agoFor me, it's never the case that new code I'm writing is SO devoid of value I'd rather pretend I never wrote it, but that's what a reset does. Rather, I keep iterating until I've made clear progress, then commit.
- kyberias 7y agoBecause git reset --hard is kinda dangerous, I've resorted to managing my changes with other safer commands. I undo changes with git checkout. Sometimes I stash and forget. I only use git reset --hard when I have accidentally committed something to an incorrect branch and I want to reset that branch to point to a specific commit after creating another branch. I strive for perfection in other areas of my like as well. :)
- atq2119 7y agogit reset --hard makes a lot of sense with printf debugging. A typical workflow starts by adding printfs or whatever your equivalent is until you've narrowed down the bug. Then you fix the bug, keeping the printfs until the fix is confirmed. Then you use git gui or an equivalent tool to form the commit(s) for your bugfix. Finally, use git reset --hard to remove the debugging detritus.
- kyberias 7y agoOk, I have to admit I've forgotten people actually (need to) do development/debugging like that.