Skip to main content
Panther Knowledge Base

How do I resolve merge conflicts and failed syncs when using the GitHub Action sync-panther-analysis-from-upstream?

Issue

When trying to keep in sync with upstream using the GitHub Action sync-panther-analysis-from-upstream, the following error occurs:

sync-panther-analysis-from-upstream: all jobs have failed

Resolution

To resolve this issue:

  1. Clone your organization’s repo.

    • gh repo clone your-org/panther-analysis-copy

  2. Checkout the primary branch.

    • git co master (or main)

  3. Fetch and pull everything from your repo.

    • git fetch && git pull

  4. Checkout the sync branch.

    • git co sync_upstream_v1.44.0

      • Make sure to replace 1.44.0 with the correct version.

  5. Ensure that you have the upstream panther-analysis as a git remote.

    1. git remote -v

      • If not, please follow the section below titled "Add upstream panther-analysis as a git remote."

    2. Fetch the upstream.
      • git fetch upstream
    3. Merge in the failing upstream branch to your local sync branch.

      • git merge v1.44.0

        • ​​​​​​​Make sure to replace 1.44.0 with the correct version.

    4. Resolve the merge conflicts.

      1. Run git status to check your status.

      2. Resolve the merge conflicts:

        1. Take the file from upstream:

          • git co –theirs $filename

        2. Keep the local edits and discard upstream’s changes:

          • git co –ours $filename

        3. If you need to make other changes: 

          • edit $filename

      3. Add the conflicting file as resolved:

        • git add $filename

 

 

After addressing the files, you can commit the changes:

 

  1. git commit
  2. Push the resolved merge to your local sync branch

    • git push origin sync_upstream_v1.44.0

      • Make sure to change 1.44.0 to the correct version.

Now you can open a pull request from your local sync branch to your local repo.

 

Add upstream panther-analysis as a git remote

If you do not have the upstream panther-analysis as a git remote, follow these instructions to add it:

  1. git remote -v
  2. git remote add upstream https://github.com/panther-labs/panther-analysis.git
  3. git remote -v

Cause

Merge conflicts and related issues can be occur for a variety of reasons depending on changes that have been made downstream. They typically occur when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other.