repo sync causes my local changes to be lost

2,155 views
Skip to first unread message

snilga

unread,
Jul 26, 2011, 9:55:29 AM7/26/11
to android-platform
Hi All,
Could anybody give me a hint how to update my local bare AOSP
repository without loosing of my local changes ?

I've created a local bare repository as:

repo init -u git://android.git.kernel.org/platform/manifest.git --
mirror -b gingerbread

to my team could use it as our local AOSP repository committing their
changes there. My colleagues init their repositories from this local
repository , then clone some project(s) from the local repository,
make some changes and push them back to local repository, for example:

# On some local desktop
git clone git://local_ip/device/samsung/crespo .
git branch SomeTask
git add .
git commit -m "Some task done"
git checkout gingerbread
git pull #to get changes made by other developer
git merge SomeTask
git push

Recently I wanted to update our local repository with AOSP's one. I
tried both :

$ repo sync
$ repo sync -n

but I see that all the changes we pushed in our local repository are
lost (fortunately I made a backup), while I expected that our changes
will be merged by sync. What am I doing wrong ?

Thanks,

Sergii.

Jean-Baptiste Queru

unread,
Jul 26, 2011, 10:44:08 AM7/26/11
to android-...@googlegroups.com
repo sync is not supposed to cause you to immediate lose changes.

However, if you're working on a detached head or on a branch that
wasn't created with repo start, repo sync will bring you back to the
upstream state if that doesn't cause you to lose uncommitted local
changes, because it assumes that this was temporary work.

Since it seems like you were on a branch, that branch still exists,
and you should be able to git checkout back to it.

If you hadn't been on a branch, git reflog would let you find where
you were and get back to it (until those commit get garbage-collected,
which by default doesn't happen for at least 2 weeks).

JBQ

> --
> You received this message because you are subscribed to the Google Groups "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
>
>

--
Jean-Baptiste M. "JBQ" Queru
Software Engineer, Android Open-Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

snilga

unread,
Jul 26, 2011, 11:41:42 AM7/26/11
to android-platform
Hi Jean-Baptiste,

Thank you for you help, but unfortunately the problem still exists.
Probably my initial explanation was not enough clear... My local
repository that I tried to update with $ repo sync is a bare
repository, so I can't create any branch (or issue $repo start) there
(can I ?).

If I clone some project as:

git clone git://local_ip/device/sansung/crespo -b gignerbread

from that local bare repository before $repo sync, I see all the
changes made by my team in my newly cloned project. But if I execute
$repo sync from the root of my bare repository and then attempt to
clone some project from there using the command above, I don't see any
changes made by my team....

Sergii.
> > For more options, visit this group athttp://groups.google.com/group/android-platform?hl=en.

Jean-Baptiste Queru

unread,
Jul 26, 2011, 11:45:11 AM7/26/11
to android-...@googlegroups.com
I'm guessing that your team is pushing changes to the gingerbread
branch on your bare mirror, but that this branch is getting reset to
the upstream state when syncing from upstream. I have no direct
experience with such setups, so it's a wild guess.

If that's accurate, I recommend that you create a separate branch for
your team to push into, and that you routinely merge gingerbread into
it.

JBQ

> For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

snilga

unread,
Jul 26, 2011, 11:59:57 AM7/26/11
to android-platform

You are absolutely right, we pushed our changes into 'gingerbread'
branch of our bare repository due to lack of experience working with
repo and git. Now I understand what's wrong and will try to fix the
issue. Thank you very much!

Sergii.

Sergey Nilga

unread,
Jul 28, 2011, 2:52:26 AM7/28/11
to android-platform
Hi All,
Sorry for bothering you again, but I've spend a lot of time finding some convenient approach how to make some changes in AOSP withing a small team and be able to share changes made by other developers inside the team, as well as periodically update our local AOSP repository with Google's one. Also we need to have a possibility to send our changes back to AOSP for pre-commit review in the future. 

Could anyone share such an experience with me ?

Thanks,
Sergii.

Jean-Baptiste Queru

unread,
Jul 29, 2011, 3:53:27 PM7/29/11
to android-...@googlegroups.com
Within the Android team, we run a private Gerrit instance for our own
code reviews, and we have scripts that auto-merge AOSP changes into
it.

We do it in 2 steps: one step mirrors changes in, and one step merges them.

To mirror them, we maintain a manifest on our internal server that has
exactly the list of project that exist in AOSP, and we run a repo
forall loop on it that does essentially git fetch / git push.

To merge them in, We do something similar, repo sync, then in a repo
forall: git checkout / git merge / git push. The difficulty here is to
deal with merge conflicts.

In our case, though, we don't need to get our changes reviewed as we
push to AOSP, so we use straight merges.

In your case, it might make sense instead to try to rebase your
changes over AOSP instead of merging, especially the ones that you
intend to submit back to AOSP.

JBQ

Reply all
Reply to author
Forward
0 new messages