Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature-request] Git resolve conflicts #1012

Open
devinrhode2 opened this issue Dec 20, 2022 · 2 comments
Open

[feature-request] Git resolve conflicts #1012

devinrhode2 opened this issue Dec 20, 2022 · 2 comments

Comments

@devinrhode2
Copy link

Sometimes there are linting or formatting changes performed by tools, not humans. Conflicts with these changes can be automatically resolved by committing with a certain syntax in the commit message, and then re-running the command by parsing that syntax.

For example, you can commit like this:

  • Run yarn prettier . --write
  • Run yarn eslint --fix

When your co-worker's pr has merged which reformats the whole codebase, you could have a lot of conflicts.

A new git alias could help here: git resolve-conflicts

It will basically do some sort of git pull origin main --rebase but will additionally auto-resolve commits which have this Run ... syntax

It's almost like a git fixup/squash/amend commit, I probably have talked about this idea on stack overflow. Syntax could be:

exec! yarn prettier . --write
@devinrhode2
Copy link
Author

@CervEdin
Copy link

I don't know if it's what you're looking for but I wrote a script to auto resolve merge conflicts using ours or theirs or both

https://github.com/CervEdin/gut/blob/main/git-resolve.sh

It uses sed to just take one side or the other, or both, while leaving the non-conflicting parts of the file alone

See this original stackoverflow answer
https://stackoverflow.com/a/68498101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants