tj / tj/git-extras

[feature-request] Git resolve conflicts

Open
#1,012 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
18.1k
Forks
1.2k
Avg merge
5d 17h
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue proposes a new git-extras alias, git resolve-conflicts, around git pull origin main --rebase and exec! commands. First clarify the commit-message syntax, rebase behavior, and how commands such as yarn prettier . --write and yarn eslint --fix are identified. Done would mean the alias safely resolves only matching formatting commits and leaves other conflicts for manual resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.