0

For reference check this answer to see what is repo.

There is a situation that I cannot understand and I would like someone to explain to me.

So far I have been using repo sync to synchronize my code with a series of repositories. After I did this and I did repo status I could see a clean state. (repo status is like git status for all repositories)

However lately when I do that, I got a series of "modified" files. It is like doing git status and getting a lot of "changes not staged for commit" (modified: afile.ext)

Why is this happening? I thought once you synchronize you get the state of your repositories with the latest changes.

My git knowledge is failing me here. Any thoughts?

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150

1 Answers1

0

According to the docs, repo sync is the equivalent of git fetch followed by a rebase. So it brings your remote-tracking branches into sync with the actual remote branches, and causes your current branch to be rebased onto the end of the remote tracking branch, but it has no effect on your working tree or the index or wherever the "modified" files are. You would still presumably need to say what you want done with the "modified" files: add-and-commit them, for instance.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • so does that means that those "modified" files were already modified *before* the synchronization? mmm strange... – KansaiRobot Jan 26 '21 at 23:52
  • 1
    yes, "modified" is about your local world (the working tree or the index); presumably `git status` would have mentioned this even before the sync...? certainly I would not expect this to be caused _by_ the sync (though I really know nothing of `repo`) – matt Jan 26 '21 at 23:55
  • 1
    I don't think you can actually rebase if there's pending changes though: pretty sure Git will complain and ask to stash changes. I think what may be happening is that your index is updated, but then Git fails to sync the working directory with the index (e.g. files are locked, etc.). If you are certain you haven't changed those files locally then you should be able to do `git reset --hard head` to reset the working directory to the last commit again. – plalx Jan 27 '21 at 02:24