Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJim Withington
12,025 PointsGit auto-merge didn't happen in the console
I am following along in the Git Basic course, and the auto-merge mentioned here didn't actually happen. Instead, I got an error talking about conflicts, and also in git log
it shows this:
Any idea why this might happen?
5 Answers
Michael Hulet
47,913 PointsWhat you ran into is a "merge conflict". That means that the same line(s) of the same file(s) was edited multiple different ways, and git doesn't know which one to use. If you open the offending file(s) (in this case, README
), you can see where git marked what's conflicting. Just delete the one you don't want, along with any text that git inserted, and then try running the merge again
Lindsay Terrell
9,888 PointsI wonder if the issue is that you made a change that was too different than what Tommy did?
Jake Wiesler
3,124 PointsSame here. Console output was completely different than the video even though I followed the exact directions.
Alirio Lancheros
3,522 PointsI also had the same problem. This is what I did before merging:
- I created a new file called README at master in which I added two lines "Line 1" and "Line 2".
- Then I added README with "git add README"
- Then I committed README with "git commit -a -m "README from scratch".
- Then I created and move to other branch with "git checkout -b branch1".
- Then I went back to master with "git checkout master".
- Then I changed "Line 1" to "Line 1a".
- Then I had to add the README file with "git add README". This step was strange for me since I had added it before.
- Then I commited it with "git commit -a -m "README has been changed to Line 1a - master".
- Then I moved to branch1 with "git checkout branch1".
- Then I commited with "git commit -a -m "README has been changed to Line 2a - branch1".
- Then I moved to master with "git checkout master".
- Then I merged with "git merge branch1".
After the above I had the following message: "Auto-merging DOC CONFLICT (content): Merge conflict in DOC Automatic merge failed; fix conflicts and then commit the result"
Please help about it. What was wrong?
Julian Betancourt
11,466 PointsFor those following along, I found this: http://githowto.com/resolving_conflicts
It seems like you have to edit the file manually and then commit the change
Jim Withington
12,025 PointsJim Withington
12,025 PointsGotcha! I still wonder why the console for the course didn't operate the way it did in the video--in other words, I watched what the instructor did, and the console didn't auto-merge in the same way. *shrug*
What can you do, eh? :-)