Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot rebase: you have unstaged changes git

Tags:

git

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.

like image 591
dagda1 Avatar asked Feb 26 '11 16:02

dagda1


2 Answers

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
like image 69
knittl Avatar answered Oct 22 '22 21:10

knittl


Remove it from the index using git rm untitled.

like image 25
Simon Avatar answered Oct 22 '22 21:10

Simon