Skip to content

Scenarios for Advanced Input

Adam Ormsby edited this page Aug 26, 2021 · 5 revisions

Some of you have specific syncing needs that aren't covered by default settings, so here's a running list of option configs to help figure things out. These are things that other devs have asked about previously, and if you know of any other great configurations for specific use cases, please share them!

When you want to sync with an active working branch

This sync action will not handle merging commit conflicts for you. That's your mess to figure out. However, you can do basic conflict selection between 'theirs' or 'ours' using the upstream_pull_args input. Be careful with the results.

To overwrite and keep the upstream repo commits => upstream_pull_args: '-s recursive -Xtheirs' To overwrite and keep the target repo commits => upstream_pull_args: '-s recursive -Xours'

When your target and upstream branches don't share a common ancestor

This will allow divergent histories to be merged, but results may not be as expected. Your mileage may vary here.

Set => upstream_pull_args: '--allow-unrelated-histories'

When one of your repositories is a shallow clone

I'm actually a bit unclear on this one - perhaps someone experiencing this issue can help clarify?

My current understanding is that either the target repo or the upstream repo get checked out as a shallow copy of the repo, but the other doesn't. This could happen if you set the --depth option on a pull or fetch, and it can result in an error:

fatal: refusing to merge unrelated histories

...which is a bit misleading.

Instead of allowing unrelated histories, you might try to use the --unshallow option in your upstream_pull_args input.

--unshallow
    If the source repository is complete, convert a shallow repository
    to a complete one, removing all the limitations imposed by shallow
    repositories.

    If the source repository is shallow, fetch as much as possible so
    that the current repository has the same history as the source
    repository.
Clone this wiki locally