Changes

Jump to: navigation, search

DPS909 & OSD600 Winter 2017 - Lab 4

1,698 bytes added, 12:18, 2 February 2017
no edit summary
# Try switching back to your <code>fav-food</code> branch, confirm that you don't have a <code>name.txt</code> file.
==4. Merge Conflicts==
Git can automatically merge most things without any help. In the previous case, we added two separate files, and git had no trouble combining them. What if we had made changes to the same file?
Let's try an experiment that will simulate two separate lines of development on the same file:
# Create a new branch called <code>animals</code> that points to the same commit as <code>master</code>.
# Create a new file called <code>animals.txt</code> and add the names of three farm animals, one per line. For example, your <code>animals.txt</code> might look like this:
horse
cow
chicken
When you're done, commit the new <code>animals.txt</code> file to your <code>animals</code> branch. Now let's start two separate changes that both work on <code>animals.txt</code>:
# Create a new branch called <code>water-animals</code> that points to the same commit as <code>animals</code>.
# On the <code>water-animals</code> branch, edit <code>animals.txt</code> to add 3 water animals. When you're done, commit your changes to the <code>water-animals</code> branch. For example, your <code>animals.txt</code> might look like this:
horse
cow
chicken
whale
seahorse
dolphin
Let's repeat this process, but this time we'll focus on animals that live in jungles:
 
# Create a new branch called <code>jungle-animals</code> that points to the same commit as <code>animals</code>.
# On the <code>jungle-animals</code> branch, edit <code>animals.txt</code> to add 3 jungle animals. When you're done, commit your changes to the <code>water-animals</code> branch. For example, your <code>animals.txt</code> might look like this:
horse
cow
chicken
monkey
python
bird of paradise

Navigation menu