question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Merge conflicts when keeping a branch up to date with main

See original GitHub issue

Subject of the issue

When creating a PR off of main to be merged into a production branch we get a ton of merge conflicts. Ideally this would not be the case but I’m not sure what we’re doing wrong or if there is even a way to avoid this. Not sure this is a bug with this action or just something we’ll have to deal with every-time we want to merge our main branch into production. Thanks for the help!

Steps to reproduce

Our github action code:

productionPromotion:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: production
      - name: Reset promotion branch
        run: |
          git fetch origin main:main
          git reset --hard main
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          branch: production-promotion

If this issue is describing a possible bug please provide (or link to) your GitHub Actions workflow.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Gabe1203commented, Jun 6, 2022

Thanks for the response! Ended up having to modify the reset promotion branch step a bit to but this works great now:

steps:
      - uses: actions/checkout@v3
        with:
          ref: production
      - name: Reset promotion branch
        run: |
          git config user.name "GitHub Actions Bot"
          git config user.email "<>"
          git fetch origin main:main
          git merge main -X theirs --allow-unrelated-histories
0reactions
denik1981commented, Sep 8, 2022

Yes, it does, but I’m not sure why you need the same branch twice if they won’t differ in anything. You could use master as your production branch for this matter. IDK, you sure have your reasons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I keep my branch up to date with master with git?
git checkout <my branch>. to switch the working tree to your branch; then: git merge master. to merge all the changes in master...
Read more >
Git merge vs rebase to keep feature branch up to date
Today we are going to look at how Git merge and rebase commands behave while trying to keep feature branch up to date....
Read more >
Keeping a feature branch up-to-date with master— rebase vs ...
Merge creates a new commit containing all the differences that got introduced in master since you branched (or since you last merged) that...
Read more >
How to keep your feature branch up to date. - TecAdmin
Checkout the master branch and switch to it · Update master branch with latest code · Change back to your feature (original) branch...
Read more >
How to Resolve Merge Conflicts in Git – A Practical Guide with ...
Always pull from remote/other related branches before you start any new logical work on your code. It will keep your branch up-to-date as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found