1

I am having problems with a rebase, here is my setup:

I have a remote git repo, and a local master branch which should mirror on the remote repo, I always branch off of my local master branch.

To update my local master I perform git fetch; git rebase <remote>

Once this has been completed I switch to my development branch git checkout my_dev_branch, and then run git rebase master. This has been working great.

But I have just performed git fetch; git rebase <remote>; and got

Cannot rebase: You have unstaged changes.
Please commit or stash them.

When I run git status I get nothing returned. I then ran git stash and tried to rebase again, but got the same error. I even tried git reset --hard <remote> but I still get the same error when trying to rebase.

Does anyone know whay I am getting this error and how to fix it?

Thanks in advance!

Cascabel
  • 479,068
  • 72
  • 370
  • 318
Lizard
  • 43,732
  • 39
  • 106
  • 167
  • It's a really long shot, but do you by any chance have changes in submodules, which could be suppressed in the output of `git status` with a config variable? – Cascabel Feb 06 '12 at 21:41
  • no idea how to check for this, relatively new to git, how should i check? – Lizard Feb 06 '12 at 21:44
  • You'd know if you had submodules in your repository; they're repositories embedded inside the parent repository. And the config setting to ignore changes is not default. You could manually make sure using `git status --ignore-submodules=none` but it sounds like it's not the case. – Cascabel Feb 06 '12 at 22:00
  • BTW, your steps to update your local master can be written as `git pull --rebase` – Lily Ballard Feb 06 '12 at 22:06
  • Hm, what happens if you run `git diff-files`? I think that's the check that under the hood leads to the error you see. If it prints anything, so should `git status`, but... something's going on. – Cascabel Feb 06 '12 at 22:14
  • I have ended up deleting the whole repo and starting again, no idea what was causing it – Lizard Feb 06 '12 at 22:56

1 Answers1

1

Have a look at this answer and see if it resolves the issue. https://stackoverflow.com/a/5255700/275583

As suggested try setting the config option and see if it resolves your issue:

git config --global core.trustctime false

Other questions related to your workflow:

Are you the only person working on this remote repository? If you are, why do you need to ever do a fetch or pull from remote since no one else has made changes?

And if you are always working on branches, then you should be able to just pull changes to your master branch whenever you want to update it.

So I am not too sure about your workflow, you may want to clarify a bit, either here or in a different question, to get a better way of working.

Good luck

Community
  • 1
  • 1
Anas Alkhatib
  • 1,110
  • 1
  • 9
  • 22