Interesting perspectives. Thanks for sharing your inputs. I can definitely 
see the need now. I guess some kind of additional check (e.g. even git 
branch for that matter) before commit from my side would definitely help / 
protect me.

On Tuesday, October 18, 2022 at 5:32:17 PM UTC+5:30 Konstantin Khomoutov 
wrote:

> On Tue, Oct 18, 2022 at 03:44:48AM -0700, Sameer Mahajan wrote:
>
> > git should not allow commit while in middle of rebase but allow only 
> rebase 
> > --continue until all conflicts are resolved.
> > 
> > are there any use cases where someone may want to commit in middle of 
> > rebase before rebase --continue? 
> > 
> > I know I shouldn't have done it but it has been a means of agony for me 
> > some times :)
>
> I, for one, do this all the time.
> After all, this is one of the reasons rebase scripts (that's what you edit 
> at
> the beginning of an interactive rebase session) gained the command "break"
> which allows to drop back into the shell at any point during performing of 
> the
> rebase sequence.
>
> Splitting commits into multiple is one reason to have this.
> Occasionally it's useful to indeed create a new commit - even applying a 
> patch
> cherry-picking an already existing change done on some other line of
> development.
>
> I'd propose two things to stop this feature from biting you in the neck.
>
> First, adopt the habit to always review the result of your actions.
> This is actually paramount to anything about software development (and I
> beleive, it applies just as well to any area of endaevor involving Git).
> Done with the rebasing? Fire up gitk and see what the history looks like.
> Or have a convenient alias for quick overview of the Git log (I have one,
> so I always to something like `git slog -10`, where "slog" stands for 
> "short
> log" and is an alias to `git log --decorate --pretty=oneline 
> --abbrev-commit`).
> Only proceed further if everything looks normal.
>
> Second, have an alias to quickly update the last commit.
> I have "recommit" which is aliased to `git commit --amend -C HEAD`,
> so when I'm rebasing and want a set of changes to be applied (committed!)
> _into_ the commit which I'm editing - that is, which is qurrently on top
> of the commit queue, I do `git recommit` and call it a day.
> Sometimes I do this multiple times in a row.
> This way, I have almost no chance of creating a "standalone" commit when I 
> don
> not want to.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/1ee71117-f95e-4a8c-b185-f7a029e40501n%40googlegroups.com.

Reply via email to