Changes

Jump to: navigation, search

DPS909 & OSD600 Winter 2017 - Lab 4

1,211 bytes added, 12:48, 2 February 2017
3. Merging
==3. Merging==
Next, let's experiment with merging. We'll start by creating a third branch:
<code>git checkout -b fav-food master</code>
This will create a <code>fav-food</code> branch which is pointing to the same commit as <code>master</code>. Confirm that you now have 3 branches (<code>master, name, fav-food</code>) using <code>git branch</code>.
 
On the <code>fav-food</code> branch, add a new file <code>food.txt</code> with a list of your favourite foods. When you're done, <code>add</code> and <code>commit</code> this file to the <code>fav-food</code> branch.
 
Let's now try combining our <code>name</code> and <code>fav-food</code> branches. If you're ever unsure about a merge, you can always try doing it on a new branch and see how it goes. Let's try doing our merge on a branch called <code>name-and-food</code>:
 
# Create a fourth branch that points to the same commit as <code>name</code>: <code>git checkout -b name-and-food name</code>
# Merge the <code>fav-food</code> branch into <code>name-and-food</code>. When you merge, you always switch to (i.e., <code>checkout</code>) the branch into which you want to merge first, then <code>merge</code> the other branch in: <code>git merge fav-food</code>

Navigation menu