I have just started working on github, so I am sorry in advance if my question seems foolish to you.
I was learning git hub and here was the problem that I am tackling. I have two branches, say master
and second-branch
I have had a readme.txt file inside the master branch having the following content:
This line lies inside the master branch
And this line as well
In the second-branch
I have had a readme.txt file as well having the following content:
This line lies inside the secondbranch
And this line as well
After that I went back to the master branch by using git checkout master
and tried merging these two branches by using the following command: git merge second-branch
Now when I tried merging these branches, it gave me a conflict error and now the readme.txt file inside the master branch had became something like the following:
This line lies inside the master branch
<<<<<<< HEAD
This line lies inside the secondbranch
=======
And this line as well
>>>>>>> second-branch
Can anyone please tell me what I am doing wrong here and how may I get this to work?
Plus what comes in my mind is that the content that lies at the same line numbers
, git gives the error to merge them... Now I wonder, in case when I'd be working on some large project and I had to change something in a file having a large number of Lines of code in a new branch, I'd surely change something at the line upon which a different code lies inside the master branch, upon merging it'd mess up all my code giving this error and the modifying the file in the master branch. Wouldn't it?
Thanks.