Re:Some bad Git situations and how I got myself out of them
by bennofs on Friday September 09, 2016 @09:33AM
(#12461992)
Even better in combination with the `:/grep` syntax that allows you to specify the commit by grepping the commit messages, prefering more recent commits: `git commit --all --fixup ':/implement some feat'`.
Re:Some bad Git situations and how I got myself out of them
by mhw on Friday September 09, 2016 @10:20AM
(#12462435)
Mmm - nice. Glad I posted it now, as I didn't know that variation!
Re:Some bad Git situations and how I got myself out of them
by dahart on Friday September 09, 2016 @09:52AM
(#12462166)
Yeah, super useful, I can second setting auto squash in the config. I was almost thinking of saying the same thing, but I realized this post is probably deliberately avoiding rebase. This workflow is advanced relative to the problems described, and you'd agree those command lines are going to look pretty intimidating to a novice, right? They were to me the first time, there's a lot to understand before they're comfortable.
Re:Some bad Git situations and how I got myself out of them
by mhw on Friday September 09, 2016 @10:26AM
(#12462494)
> This workflow is advanced relative to the problems described
Yeah, true. I posted it mostly because one of the bigger threads of comments was advocating using a GUI instead of the CLI. I'm not going to argue that the git CLI is simple, but it does have some nice features to support specific common workflows.
Re:Some bad Git situations and how I got myself out of them
by aromatt on Friday September 09, 2016 @12:43PM
(#12463858)
Yep. I find that most of the time, the commit I want to fixup is my last one, so I don't even need the interaction. I use this script almost every day:
last_commit=$(git log --oneline | head -1 | cut -d' ' -f1)
git commit -a --fixup ${last_commit}
GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash ${last_commit}~1
Handy enough that I set rebase.autoSquash to true in my ~/.gitconfig so 'git rebase -i' always works like this.