Google is committed to advancing racial equity for Black communities. See how.

fx sync-to

Sync the local Fuchsia source tree to a given state

usage: fx sync-to [-h|--help] <STATE>

To reproduce builds at a given repo state, or bisect bugs among a series of
checkins, this command synchronizes the local Fuchsia source tree to a given
state. The state can be specified in one of the following ways:

 BUILD_ID: a large number like '8938070794014050064' (preceded or not by a
   'b' letter), which is the "Build #" in a builder's "Ended builds" page,
    for example:

 RELEASE_TAG: a string like "releases/0.20190927.1.1", representing a
   git tag in the //integration repository. To find available tags, run
   `git tags -l` in your local integration repository.

 BRANCH_NAME: a string like "refs/heads/releases/f1", representing a
   git branch (head) in the //integration repository.

 JIRI_HISTORY_TIMESTAMP: a timestamp like "2019-03-21T15:30:00-07:00".
   This is local to your tree, and represents a moment where you
   previously ran `jiri update`. To find available timestamps, look at
   files in ${FUCHSIA_DIR}/.jiri_root/update_history/

 INTEGRATION_GIT_COMMIT: a 3-40 character commit hash like "e9d97d1" in the
   integration repo. Can be optionally prefixed with 'git:' (e.g.
   "git:e9d97d1") to disambiguate from BUILD_ID. To find valid commits,
   look at your integration commit history:
      git -C ${FUCHSIA_DIR}/integration log --oneline

   Use "reset" to return to the top of the tree. This is equivalent to:
     git -C ${FUCHSIA_DIR}/integration checkout JIRI_HEAD && jiri update -gc

Known limitations:
- Does not work on CI builds triggered on repos other than integration (very
  rare). It works on all CQ builds and all CI builds triggered by
  integration.git commits.
- Does not respect `attributes`. Local attributes will not be overridden (so
  the checkout may contain some extra repositories), and
  attributes used by an infra build will not be reproduced


# Sync to the source used by build
fx sync-to 8835832080588336881

# Sync to the source tagged as release 0.20210822.2.5:
fx sync-to releases/0.20210822.2.5

# Sync to the same tree updated in 2021-08-28T14:26:22-07:00 (this is
# local to your local tree - to reproduce, look for timestamps in your
# own .jiri_root/update_history directory):
fx sync-to 2021-08-28T14:26:22-07:00

# Sync to integration commit 901ed5b
# (
fx sync-to 901ed5b

# Sync to release branch f1:
fx sync-to refs/heads/releases/f1

# Restore your source to the top of the tree:
fx sync-to reset

sync-to source code