# skipping commits via commit-msg contents

4 messages from 2010-07-12 to 2010-07-12. Participants: Jim Cromie, Ramkumar Ramachandra, Jonathan Nieder.
Thread: https://gitlist.dev/t/24377

## Jim Cromie, 2010-07-12 18:21

Subject: skipping commits via commit-msg contents
Message-ID: <AANLkTikYcODU96J-cVYCIad1yrd5zGklVj2OV4UT2PxC@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikYcODU96J-cVYCIad1yrd5zGklVj2OV4UT2PxC%40mail.gmail.com

```
sometimes its desirable to commit incomplete work separately,
for example a struct change thats intended to get compiler to report
where changes are needed.

if git bisect were to recognize  --skip-bisect  in the subject line
(or in commit-message somewhere, say top or bottom),
then bisection could proceed silently past such commits.

This would also allow rebasing a patchset to markup crappy commits
which need further work.

worth having ?

```

## Ramkumar Ramachandra, 2010-07-12 18:35

Subject: Re: skipping commits via commit-msg contents
Message-ID: <20100712183518.GE17630@debian>
URL: https://gitlist.dev/e/20100712183518.GE17630%40debian
In-Reply-To: <AANLkTikYcODU96J-cVYCIad1yrd5zGklVj2OV4UT2PxC@mail.gmail.com>

```
Hi Jim,

Jim Cromie writes:
> sometimes its desirable to commit incomplete work separately,
> for example a struct change thats intended to get compiler to report
> where changes are needed.
> 
> if git bisect were to recognize  --skip-bisect  in the subject line
> (or in commit-message somewhere, say top or bottom),
> then bisection could proceed silently past such commits.
> 
> This would also allow rebasing a patchset to markup crappy commits
> which need further work.

This is perhaps not exactly what you want, but I thought I'd mention
it anyway: I usually prefix commit messages of temporary commits with
a "fixup! " or "squash! " and then use the `--autosquash` feature of
`git rebase --interactive` in a new branch before running `git
bisect`.

-- Ram

```

## Jonathan Nieder, 2010-07-12 19:02

Subject: Re: skipping commits via commit-msg contents
Message-ID: <20100712190203.GA9365@dert.cs.uchicago.edu>
URL: https://gitlist.dev/e/20100712190203.GA9365%40dert.cs.uchicago.edu
In-Reply-To: <AANLkTikYcODU96J-cVYCIad1yrd5zGklVj2OV4UT2PxC@mail.gmail.com>

```
Hi Jim,

Jim Cromie wrote:

> if git bisect were to recognize  --skip-bisect  in the subject line
> (or in commit-message somewhere, say top or bottom),
> then bisection could proceed silently past such commits.

In addition to Ram’s suggestion, you might want to look into
‘git replace’[1].  It can be useful when the broken commits
have already been published.  It works like this:

 git replace <bad commit> <bad commit>^

and then ‘git bisect’ and lower-level commands like git show and
checkout will silently substitute the parent of the broken commit
when ever you refer to it.

You can publish the resulting “replace refs” in the refs/replace/*
namespace and anyone who explicitly chooses to fetch them will be
able to see the same effect.

Two problems:

 - bisect skip is a bit more sophisticated (read: better) than just
   substituting a parent, especially when the commit to be skipped
   is a merge.  So it might still make sense to teach bisect to
   respect a refs/notes/skip-bisect note that requests for it
   to skip a specific ref.

   One can try this out by making an appropriate wrapper script
   for ‘git bisect next’ (using ‘git notes’).

 - replace refs are a little too powerful.  It would be nicer to
   by able to use ‘git replace --refs=refs/replace/bisect/’
   and ‘GIT_REPLACE_REFS=refs/replace/bisect/ git bisect’ to
   make them take effect only when needed.  In other words,
   it would be nicer if “git replace” were configurable in the
   same way as “git notes” is.

   One can get something like that effect by using git for-each-ref
   and git update-ref to rename replace refs into place only when
   needed.

[1] http://www.kernel.org/pub/software/scm/git/docs/git-bisect-lk2009.html#_git_replace

```

## Jim Cromie, 2010-07-12 19:56

Subject: Re: skipping commits via commit-msg contents
Message-ID: <AANLkTikVNpFPBMO_SDIfn-5np42ALI-qGAHTOvlmONxo@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikVNpFPBMO_SDIfn-5np42ALI-qGAHTOvlmONxo%40mail.gmail.com
In-Reply-To: <20100712190203.GA9365@dert.cs.uchicago.edu>

```
thanks guys,

Ram, not what I want, but good to know..

Jonathan, replace feels like a big hammer for a newbie..
I havent published these, since they need bisection amongst other reasons :-O
and the BUGS also require more -fu to understand than I possess


On Mon, Jul 12, 2010 at 1:02 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi Jim,
>
> Jim Cromie wrote:
>
>> if git bisect were to recognize  --skip-bisect  in the subject line
>> (or in commit-message somewhere, say top or bottom),
>> then bisection could proceed silently past such commits.
>
> In addition to Ram’s suggestion, you might want to look into
> ‘git replace’[1].  It can be useful when the broken commits
> have already been published.  It works like this:
>
>  git replace <bad commit> <bad commit>^
>
> and then ‘git bisect’ and lower-level commands like git show and
> checkout will silently substitute the parent of the broken commit
> when ever you refer to it.
>
> You can publish the resulting “replace refs” in the refs/replace/*
> namespace and anyone who explicitly chooses to fetch them will be
> able to see the same effect.
>
> Two problems:
>
>  - bisect skip is a bit more sophisticated (read: better) than just
>   substituting a parent, especially when the commit to be skipped
>   is a merge.  So it might still make sense to teach bisect to
>   respect a refs/notes/skip-bisect note that requests for it
>   to skip a specific ref.

This sounds nice.
Notionally, extending it further would be cool -

[jimc@groucho perl-git]$ git notes show 2de9db42d3e578becacbd237bf4f59b432cc82f0
good make test

with this note, Ive told myself that it passes (good), and what it
passes (make test)

I could imagine bisect knowing enough to take that as an implicit start,
unless overridden on a command line, or by a similar note on a later commit.

a note like:
skip-bisect until <tag|commit|branch>
could be cool too, though there may be deeper problems with skipping
entire subranges.

thanks again,
Jim

```
