dagda1
dagda1

Reputation: 28810

cannot rebase: you have unstaged changes 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.

Upvotes: 13

Views: 48215

Answers (2)

knittl
knittl

Reputation: 265261

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

Upvotes: 16

Simon
Simon

Reputation: 32893

Remove it from the index using git rm untitled.

Upvotes: 2

Related Questions