I'm writing a text file, its name "f2.txt". I did a commit for each line of the file. Its content would be:
l1
l2
l3
l4
In other words, it has four commits.
Each commit for each line.
So I tried to revert a commit. I get a conflict. Even tought I thought doing like that I wouldn´t get any conflict, cause it is a commit for each line. (Not the same line)
But yes, I do get conflict, even doing something simple like that.
What happens here?
Why I get conflict(s)?
Thanks.
I assume you have tried to revert a commit which was not the last one.
Conflicts happen when the context changes.
You have 4 commits:
Now you try to revert the 3rd commit. Git is not sure what to do, it can see l2 which is before, but it is expecting end of file and instead you have l4.
It is obviously a bit more complicated than that. The patch command is smart enough to detect lines that moved and so on, but this is basically it.
Update
I don't really see any solution other than manually solve the conflicts.
You can read about merges and conflicts in git-tower