cannot rebase: you have unstaged changes git

40,477

Solution 1

the file is deleted and is already tracked by git. you can:

  1. delete the file and commit the change (git rm --cached untitled; git commit) or
  2. run git checkout -- untitled to get back the file

Solution 2

Remove it from the index using git rm untitled.

Share:
40,477

Related videos on Youtube

dagda1
Author by

dagda1

Updated on May 23, 2020

Comments

  • dagda1
    dagda1 over 2 years

    I am on a branch named new_nlp and when I do a git status, I get the following:

    # On branch new_nlp
    # Changed but not updated:
    #   (use "git add/rm <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #   deleted:    untitled.
    

    I cannot see this file untitled as it is deleted.

    I want to switch to master and perform a rebase from new_nlp but when I checkout master and issue the command:

    git rebase new_nlp
    

    I get the following error message:

    cannot rebase: you have unstaged changes
    D   untitled.
    

    I cannot see this file and I have no idea how to delete it. I have no idea how it got added.

    Does anyone know how I can get past this road block. I have no idea why the file remains in the index.

  • knittl
    knittl almost 12 years
    git will most likely complain. either use --cached or -f options

Related