| ▲ | jolmg 4 hours ago |
| > scary rebase -i commands that can leave your tree in a half-broken state if you so much as sneeze `git rebase --abort` exists. One can also set a tag or something before doing the rebase, do whatever, then `git reset --hard $set_tag` to go back. Nothing to be scared of. Not like the prior state is lost. |
|
| ▲ | rmunn 3 hours ago | parent | next [-] |
| I have so many branches named `temp` or `before-rebase` for exactly that reason; I'm using them effectively as tags, but branches can be moved around with less ceremony than tags (since tags are designed to be for things like v1.2.3, placed once and then almost never moved again), so I usually just do `git branch before-rebase/some-feature` before running a big `rebase -i`. I've almost never needed to run `get reset before-rebase`. But I have often done `git log -p before-rebase` and compared that to the post-rebase state of the branch, to ensure that the merge-conflict resolution(s) that came up during the rebase haven't accidentally introduced an unintended change. |
| |
| ▲ | chrismorgan an hour ago | parent | next [-] | | Diffing diffs is so valuable for that reason, seriously underrated. Once I even found a use case for diffing diff diffs. I also often wish to edit commits or resolve rebase conflicts or whatever by editing the patch rather than the files. | |
| ▲ | jolmg 3 hours ago | parent | prev [-] | | > but branches can be moved around with less ceremony than tags `git tag -f` to move a tag. Personally, I just do `git show` when I'm feeling cautious, but I can generally just scroll up to find the last `git commit` I did with the hash in the output. `git reflog` should also have record of it, so everything else is kind of extra. | | |
| ▲ | rmunn 3 hours ago | parent [-] | | Good point, that's no more ceremony than moving a branch. I guess I've just gotten "branches are movable tags" so deep into my hindbrain that I absorbed "tags are hard to move". But that's not actually true, and for what I'm doing (save this point in history for a while) a tag makes slightly more sense, semantically, than a branch. | | |
|
|
|
| ▲ | catlifeonmars 4 hours ago | parent | prev [-] |
| Do you use git reflog? |
| |
| ▲ | jolmg 3 hours ago | parent [-] | | One can also use that, or just `git log -n1` and taking note of the commit hash. So many options. |
|