# Upload changes from multiple repositories

Certain changes require modifying more than one repository simultaneously. There are two
supported methods for accomplishing this: soft and hard transitions.

In general, prefer soft transitions over hard transitions (see
[Making changes across multiple petals](https://fuchsia.dev/fuchsia-src/development/source_code/working_across_petals#hard-and-soft-transitions) for
further details). This means that if a change to one repository depends on a change in another
repository, you must wait until the respective commit has been rolled before the dependent commit
can be submitted to the queue.

Most multi-Petal changes (including
[updates to FIDL protocols](https://fuchsia.dev/fuchsia-src/development/source_code/workflow_tips_and_faq#q_how_do_i_update_a_fidl_protocol)) should
be attempted using a soft transition, whereas coordinating
[changes across multiple Petals](https://fuchsia.dev/fuchsia-src/development/source_code/workflow_tips_and_faq#q_how_do_i_coordinate_changes_across_multiple_petals)
*may* require a hard transition. Typically, one should use the techniques described in the above
references to avoid hard transitions wherever possible.

## Using jiri upload

To upload changes together, you need to create a branch with same name on all repositories.

Do the following:

1. Make and commit the first change in a Fuchsia repository:

   1. Go to the repository:

          cd examples/fortune

   2. Create a new branch; for example, *add_my_new_feature*:

          git checkout -b add_my_new_feature

   3. Edit and add the files related to the feature:

          git add <my_feature_related_files>

   4. Commit your first change:

          git commit

2. Make and commit the second change in another Fuchsia repository:

   1. Go to the second repository:

          cd fuchsia/build

   2. Create a new branch with the same name, *add_my_new_feature*:

          git checkout -b add_my_new_feature

   3. Edit and add the files related to the feature:

          git add <more_of_my_feature_related_files>

   4. Commit your second change:

          git commit

3. Use `-multipart` to upload all changes with the same branch name across repos:

       jiri upload -multipart

After the changes are submitted, clean up the local branches:

    cd examples/fortune
    git branch -d add_my_new_feature

And

    cd fuchsia/build
    git branch -d add_my_new_feature

## Using Git command

You can also use the `git` command to upload all changes across repositories.
The steps are identical as the steps in [Using jiri
upload](https://fuchsia.dev/fuchsia-src/development/source_code/upload_changes_from_multiple_repositories#using-jiri-upload); however, instead of `jiri upload -multipart` in Step 3, use the
following `git` command to upload your changes from each repository you have modified:

    git push origin HEAD:refs/for/main

Note that this command must be run from the working directory of each repository.
[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/development/source_code/upload_changes_from_multiple_repositories.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/development/source_code/upload_changes_from_multiple_repositories.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/development/source_code/upload_changes_from_multiple_repositories.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/development/source_code/upload_changes_from_multiple_repositories.md "Edit the source code of this page")