After more than a decade of using git, I know that my comfort with rebase, and confidence that I wont make an error I can't undo, comes from knowing that I can always abort. And assuming it wasn't garbage collected, I can always get back to orphaned commits, or the commit before I rebased, as long as I keep their hashes. I can definitely look back on my less confident days as times when I wrongly assumed I was walkin…
Git rebase -i is not that scary
31–40 of 155 posts
Re: Git rebase -i is not that scary
#32That “-I” really needs to be lowercase.
Yeah I got quite excited that there was somehow a better -i; its almost perfect clickbait
I'm really not fond of having to `git rebase --interactive` just to drop all commits that are "already in master", especially when I forget this silly step and get a borked rebase.
Re: Git rebase -i is not that scary
#33Re: Git rebase -i is not that scary
#34I wish there were a shorthand for x git commit --amend --reset-author --no-edit I use that one very frequently (after a fixup, of course) because I want the author date on amended commits to reflect the last time I edited them, not the first time I committed them.
get ahead at work? split into commits and make it look like multiple days of work
work on your own IP during work hours? edit the timestamp to be outside work hours (i even have a script for this)
Re: Git rebase -i is not that scary
#35I feel like if you're scared of rebasing, you don't actually understand git.
My fear has never been rebasing itself, but that I make some kind of mistake with a random change conflict and don't notice it because it's not tested for directly. But I'm also not sure if that's categorically a git fear. (Edit: related to this, I think this sort of minor "itchy worry" is grounded in how sometimes conceptually simple diffs look messy during conflict resolution.)
Re: Git rebase -i is not that scary
#36- git rebase -i ^
- select edit
- git reset --soft HEAD~
- make some changes
- git add . && git commit -m "changes"
- git rebase --continue
- Am I using git rebase wrong?
Re: Git rebase -i is not that scary
#37I feel like if you're scared of rebasing, you don't actually understand git.
The part where git needs to be “understood” is the entire problem. “Do one thing and do it well” was the whole mantra, which was completely ignored with the disaster that is git. It’s objectively awful.
Re: Git rebase -i is not that scary
#38I wish there were a shorthand for x git commit --amend --reset-author --no-edit I use that one very frequently (after a fixup, of course) because I want the author date on amended commits to reflect the last time I edited them, not the first time I committed them.
Re: Git rebase -i is not that scary
#39 git reset HEAD^1 (NO --hard!)
git commit --patch ...
git rebase --continue
You want to add some pending changes to the previous commit? No problem: git commit --patch --amend ...
You want to move the pending changes to future commits? git stash
git rebase --continue
git stash popRe: Git rebase -i is not that scary
#40Earlier quoted context omitted.
Yeah I got quite excited that there was somehow a better -i; its almost perfect clickbait
I was hoping for a rebase that recalled what your previous base commit of your branch. I'm really not fond of having to `git rebase --interactive` just to drop all commits that are "already in master", especially when I forget this silly step and get a borked rebase.
git rebase -i master..HEAD
The gitrevisions(7) manpage is a good reference to keep in your back pocket, I find.https://www.man7.org/linux/man-pages/man7/gitrevisions.7.htm...