Search code examples
gitcrashrebase

git rebase stopped working in git for windows


I'm observing very strange crashes in git rebase. Operations that I'm performing haven't change, but their result has changed since some time ago.

Instead of rebased branch I get help message from git rebase, describing command line options, and file bash.exe.stackdump with some hex numbers.

The same behavior is observed during execution of git pull --rebase. Rebasing pulled commits is my default setting therefore this misbehavior is very annoying.

Example:

$ git rebase master feature/tune-logging
usage: git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]
   or: git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]
   or: git rebase --continue | --abort | --skip | --edit-todo

Available options are
    -v, --verbose         display a diffstat of what changed upstream
    -q, --quiet           be quiet. implies --no-stat
    --autostash           automatically stash/stash pop before and after
    --fork-point          ....

    [ skip ... ] 

Actions:
    --continue            continue
    --abort               abort and check out the original branch
    --skip                skip current patch and continue
    --edit-todo           edit the todo list during an interactive rebase
    --quit                abort but keep HEAD where it is
    --show-current-patch  show the patch file being applied or merged

I use Windows 7 x64, with recent updates. git version 2.18.0.windows.1

I also use SmartGit, running the same git executable.

Here is the output, obtained with GIT_TRACE=2

$ GIT_TRACE=2 git rebase master feature/tune-logging                                                                             
11:13:05.925709 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin                         
11:13:05.927709 git.c:654               trace: exec: git-rebase master feature/tune-logging                                      
11:13:05.927709 run-command.c:637       trace: run_command: git-rebase master feature/tune-logging                               
11:13:06.348751 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:09.354050 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:09.356050 git.c:415               trace: built-in: git rev-parse --git-dir                                                 
11:13:09.778092 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:09.779092 git.c:415               trace: built-in: git rev-parse --git-path objects                                        
11:13:10.122126 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:10.123126 git.c:415               trace: built-in: git rev-parse --is-bare-repository                                      
11:13:10.452159 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:10.453159 git.c:415               trace: built-in: git rev-parse --show-toplevel                                           
11:13:10.827196 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:10.829197 git.c:415               trace: built-in: git config --bool rebase.stat                                           
11:13:11.210235 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:11.212235 git.c:415               trace: built-in: git config --bool rebase.autostash                                      
11:13:11.548269 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:11.550269 git.c:415               trace: built-in: git config --bool rebase.autosquash                                     
11:13:11.869301 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:11.871301 git.c:415               trace: built-in: git config --bool commit.gpgsign                                        
11:13:12.330347 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:12.754389 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core            
11:13:12.755389 git.c:415               trace: built-in: git rev-parse --parseopt --stuck-long -- -h                             
usage: git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]                                       
   or: git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]                                             
   or: git rebase --continue | --abort | --skip | --edit-todo                                                                    

Available options are                                                                                                            
    -v, --verbose         display a diffstat of what changed upstream                                                            
    -q, --quiet           be quiet. implies --no-stat                                                                            
    --autostash           automatically stash/stash pop before and after                                                         

  [skip ]

Branches master and feature/tune-logging do exist.

UPDATE.

Tried rolling-back git to some previous version.

  1. Randomly chosen git version 2.12.2 worked fine, but caused complains of the SmartGit about too old git and suggestion to use version at least 2.16

  2. Upgraded git to 2.16.2 - same crashes.

UPDATE 2.

I describe my experiments.

Create a new branch on some old commit from the master, add dummy file, commit, delete dummy file, commit, rebase:

--c1--c2--c3--master
   \
    d1-add dummy file--d2-remove dummy file--

UPDATE 3

Tried git versions 2.15 and 2.14. Version 2.15 gives the same crashes, version 2.14 works.

Will stop on it for now, until the reason of crashes will be resolved. I'll try to provide additional information on order to find it.

UPDATE 4

I usually work with the SmartGit, which is a GUI front-end to git, but all the results above were obtained using command line.


Solution

  • Updated git to 2.19, the issue has gone.

    While installing new git version, setup wizard has shown two checkboxes, asking to turn on new experimental built-in features: rebase and stash.

    I've left them unchecked.

    use external rebase and stash

    Updated to git 2.19.1.windows.1, now turned those checkboxes on. Everything still works.