I have a problem with git that I can not understand.
I have a branch in which I am the only person working and I update it from two different computers.
Suppose I create the branch from computer A, make changes and upload them to the remote repository by pushing.
The next day, I go to the computer B, I make a fetch to get the branch, I get into it, I work without problems and I push the changes.
Now I go back to computer A, I do a fetch and changes are detected (as expected). If I do a status, it tells me that I have changes. I do a git pull and I get conflicts in the files that I modified the first day from the computer A.
How is possible have conflicts in my own branch when no commit is pending? I am the only person working on it, should not the files be updated cleanly without conflicts?
I have also tried with fetch + merge and the same conflicts happens.
I am doing something wrong? Or is git working wrong?
Let me make sure that I'm understanding what you're describing. It sounds like what you're doing is:
If the above is a summary of the general workflow you. follow, then you shouldn't see any conflicts. If you deviate from this at all, then it is possible to see conflicts. For example, if you use `git fetch` instead of `git pull`, you could see some conflicts because `git fetch` only updates your local repository with new records from the central repository, it doesn't update your working directory.
Honestly, there are any number of ways that you could get the end result you're describing if you don't strictly ensure that each computers' local working directory is completely clean at every step. Some examples:
Trust me, I occasionally forget to add a file or forget to commit before I push. These kinds of things happen to even git experts from time to time. But as you get used to the natural rhythm of things, it will happen less often.
On the other hand, it is possible though not likely at all, that you have found a bug. If you can detail exact steps to reproduce the behavior you're seeing, please share them and we can investigate.
I hope that helps!