Is it better to have as many commits in Git as possible, or as few as possible?

I recently had a debate with a colleague, and he is adamant that as little as possible is done due to merge conflicts. I argue that the more details you use, using as many commits as possible, the better.

Is it better to have more commits, or less, and why?

+1
source share
3 answers

If your colleague discourages a lot of commits, because for some reason this causes more merge conflicts, then this is wrong, the number of commits has nothing to do with merge conflicts. If your code will conflict when merging a branch into another, it does not matter if this branch has 1 commit or 1000, this will lead to a conflict in any case.

, Git "" ( ). , , .

, , , , , , , . - 1 , , . , .

, , , , , , .

+8

. :

X ( X)

X,

. , , , .

+3

Commit in advance, commit frequently. Good article on this topic by Seth Robertson.

I do not understand the fear of arguments about merge conflicts in order to commit rarely. The larger the value, the greater the likelihood that you will have merge conflicts, and the more difficult it is to resolve them.

+2
source

Source: https://habr.com/ru/post/1655815/


All Articles