- i often go back like 5 commits and make changes like this - 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?
Git rebase -i is not that scary
81–90 of 155 posts
Re: Git rebase -i is not that scary
#82Re: Git rebase -i is not that scary
#83 git reset --hard @{1}
After a rebase to "undo" it.Re: Git rebase -i is not that scary
#84A workflow I was introduced to and have worked with a lot in my teams is, 1. Everyone uses feature branches 2. Everyone cleans up their branch using interactive rebase on top of main before review 3. All merges have been freshly rebase on main I think it works very well and keeps the history clean while preserving "each commit does one thing".
Re: Git rebase -i is not that scary
#85After 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…
Re: Git rebase -i is not that scary
#86Git rebase isn't scary at all, what's scary is the git rebase cult. I'll probably die never really seeing the tangible benefit a meticulously curated git history provides but at least I saw a few hundred blog posts and hn comments declaring the moral failure that is not having the cleanest commit history. The cynic in me would say that people are over-identifying too much with their recent bikeshedding addiction (jus…
Re: Git rebase -i is not that scary
#87A workflow I was introduced to and have worked with a lot in my teams is, 1. Everyone uses feature branches 2. Everyone cleans up their branch using interactive rebase on top of main before review 3. All merges have been freshly rebase on main I think it works very well and keeps the history clean while preserving "each commit does one thing".
I worked on a team that did this, + required feature branches to get squashed to a single commit before merge. On that commit, we'd require a very brief bullet list of changes, sometimes a POC, and a link to the PR. This made git blame a lot more helpful when debugging issues. I am a big fan of this approach.
one of the first things i do in a new gitlab repo is set up ff+squash commit merges with the squash commit message template automatically pulling the MR title, link, description, authors etc.
%{title}
-
ref: %{reference}
url: %{url}
authored by: %{merge_request_author}
merged by: %{merged_by}
-
%{description}Re: Git rebase -i is not that scary
#88I 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.
That's it. That basic knowledge will carry you far, and will be useful a decade from now. Those are the three best afternoons you can spend. Do it out of respect for the computer.
Re: Git rebase -i is not that scary
#89Git rebase isn't scary at all, what's scary is the git rebase cult. I'll probably die never really seeing the tangible benefit a meticulously curated git history provides but at least I saw a few hundred blog posts and hn comments declaring the moral failure that is not having the cleanest commit history. The cynic in me would say that people are over-identifying too much with their recent bikeshedding addiction (jus…