What is merge conflict ?
Most questions out there address resolving merge conflict
like this one.
But I have no clue to why its even happening to me...
In short, we were told to:
git clone url ~/lab
Now we had to edit these files and then commit the changes.
For second assignment we need to do the following:
git commit -am 'changes to lab1 after handin'
git pull
git checkout -b lab2 origin/lab2
git merge lab1
Now my partner sent me his files for lab1
. So I can work on his code as it's cleaner and more organized.
git status
>>> nothing to commit, working directory clean
I then delete all files
git status
>>> list of deleted files
git commit -am 'delete my files'
git status
>>> nothing to commit, working directory clean
I then extracted his files to my directory
git status
>>> list of untracked files in red
git add .
git status
>>> Changes to be commit and the list of files in green
git commit -am 'teammate files'
git status
>>> nothing to commit, working directory clean
Now TA commands
git commit -am 'changed branch'
git pull
>>> Already up-to-data. (As expected!!)
git checkout -b lab2 origin/lab2
>>> On branch lab2
git merge lab1
>>> almost all files failed merge and have conflict
Any explanation to why is this happening ? and how could I prevent this ?
I am afraid to do this on my own as I might remove code which shouldn't be removed... so I'd rather git merge
to work on its own.