Shooting's Blog

Repo Problem

Repo sync failed

Issue

  • Repo Sync failed (error: branch xxx is published (but not merged) and is now n commit behind)
  • Cannot do ‘mtk_repo sync’ (after last upload to Gerrit) is published (but not merged) and is now x commits behind since last upstream (R1)

Reason

  C1 <- C2 <- C3 <- N1 <- N2 <- N3 <- N4 <- N5 (Server latest)
              ^<------R1<--------^
              (branch1)  (cherry-pick)
  • R1 != N3 (even R1 is picked/rebased)
  • Local is R1, server latest is N5

Solution

1.1: repo start $localbranch . to create a new local branch
1.2: repo sync . to update local branch to latest

2.1: git remote update to fetch objects from remotes
2.2: git reset --hard <remote>/<branch> to reset local branch as the same as server
------ (git remote to get remote names)