Samer Alatawnh
Samer Alatawnh

Reputation: 13

How do you handle git merge conflicts in case developers are using different code beautifier?

The situation now, I’m getting git conflicts even though the codes are similar but each developer is formatting the code differently.

Upvotes: 1

Views: 202

Answers (1)

joshmeranda
joshmeranda

Reputation: 3251

This exact situation is one of the reasons code linter were developed.

lint, or a linter, is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. The term originates from a Unix utility that examined C language source code

You can use a linter to enforce a code convention among you and your project partners. Linters can enforce things like indentation, spacing around operators, etc.

With everyone using the same format, the conflicts should be minimized, and when they do occur the linter will often tell you how to fix the styling.

Upvotes: 2

Related Questions