1

I have downloaded Android source code with repo, then I made some changes in frameworks/base/packages. Now when I trying to do repo sync, it gives me this error:

Syncing work tree: 60% (151/251) error: You have local changes to 'packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java'; cannot switch branches.

How to fix it and upgrade all the projects that have no changes?

artem
  • 16,382
  • 34
  • 113
  • 189
  • You can do a "[git stash](http://book.git-scm.com/4_stashing.html)" and "git stash apply" in frameworks/base for instance. – Jens Apr 28 '12 at 19:49
  • Using the repo tools, I get `fatal: Not a git repository (or any of the parent directories): .git` because there isn't a .git directory. Just a .repo directory. – GrandAdmiral Sep 09 '14 at 21:18
  • Hi, Getting the same error. Any comment – Ghost Nov 13 '14 at 06:47

1 Answers1

4

As Jens comments, stashing is a good option here (for uncommitted changed.
It allows to save your local modification, git pull and git stash apply said modifications back.
See for instance "Can't pull or push after git clone - local changes".

If you had already committed changes, it would be best to:

  • make a tmp branch at your current HEAD
  • reset HEAD to origin/master
  • re-try the repo sync.
  • merge tmp to master
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi, Can you tell me how to stash. It has .repo and not .git. Giving me error fatal: not a git repository – Ghost Nov 13 '14 at 07:07
  • 1
    @Ghost If I read http://stackoverflow.com/a/11870480/6309 correctly, the git repo is in `.repo/repo` or in `.repo/projects/xxx` – VonC Nov 13 '14 at 07:31