← Back to team overview

kicad-developers team mailing list archive

Re: Rebase the tree?

 

Hi,

On 17.01.20 19:14, Simon Richter wrote:

> 1. "git rebase -i origin/master"
> 2. in the editor, if they are present, remove the lines
> 
>     pick ea31730b4 Handle error returns from lstat.
>     pick e83420f19 Remove file accidentally commited in ea31730b4
>     pick e27e6ee16 Also catch null dereference in case wxASSERT was skipped.
>     pick e1925b89c Remove file accidentally added in e27e6ee1
> 
> 3. save and exit

Even less interactive:

    git filter-branch \
        --prune-empty \
        --index-filter \
            'git rm --cached --ignore-unmatch common/libcommon.a.*' \
        9df2cfb32..HEAD

This rewrites the current branch to a state where the files were never
added, and removes the now-empty correction commits. The SHA1 sums in
the new branch are different, but as the commit contents are identical,
rebasing feature branches then goes smoothly even from the gitlab GUI.

If you rebased a branch containing the offending commits on top of a
cleaned one, this generates four commits adding and removing the files
with no further changes, and the filter-branch commit above then reduces
these to no-ops and removes the commits.

A simple test in gitlab *merge request is descended from e1925b89c"
could identify merge requests that would need to be rewritten.

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References