4 ms·
I have a funny little habit that probably stems from a certain degree of paranoia when working on a decent-sized change. I like to keep a local patch of it, as
by pncnmnp 2y ago
I have a funny little habit that probably stems from a certain degree of paranoia when working on a decent-sized change. I like to keep a local patch of it, as follows: "git diff > works.patch"
Later on, you can apply it if necessary with "git apply works.patch".
- erik_seaberg 2y agoDo you find that better than a stash or a branch because it shows up in ls?
- pncnmnp 2y agoYes, it can be nice as an archival thing. Keep a directory filled with experimental patches you made to certain parts of your code. Maybe branches are better for certain use cases. I use stash too, but for different purposes. For instance, when I'd like to quickly change branches to fix a bug/issue and then come back to my stuff. Sometimes, I use stash for resolving potentially complicated pre-commit merges as well.
- BossingAround 2y agoYou could use stash for just that use case (even multiple times to make multiple "patches"). For a more robuts method, you could also just commit (without pushing of course). Then, you can do "git reset --hard HEAD~1", and you have a pre-patch env ready for more work. When you need to re-do your commit, you can check reflog to get the ID. Either way is, to me, an easier way to achieve the same result as patches.
- puddingvlaai 2y agoInstead of looking up the commit hash in your reflog, you could also just create a branch on that commit and refer to the commit with the branch name.