Return to Video

New - Merging the Changes Together 2

  • 0:00 - 0:03
    Since I've already run git fetch,
    my origin/master will
  • 0:03 - 0:07
    contain Sarah's changes, which I
    can verify by running git status.
  • 0:07 - 0:09
    As expected, I see that my branch and
  • 0:09 - 0:14
    origin/master have diverged and
    have one and one different commit each.
  • 0:14 - 0:17
    Now I'm ready to merge Sarah's
    changes into my local master.
  • 0:17 - 0:20
    So, to do that, first I'll make sure
    I have the master branch checked out.
  • 0:20 - 0:21
    And then I'll run git merge, and
  • 0:21 - 0:27
    the two branches I want to merge
    are master and origin/master.
  • 0:27 - 0:31
    Like I expected, I got a merge conflict,
    so I'll open the file and resolve it.
  • 0:31 - 0:34
    So I can see here's the original version
    before either of us made changes.
  • 0:35 - 0:38
    Here are my changes
    with onion power added,
  • 0:38 - 0:41
    and here is Sarah's version
    with cumin removed.
  • 0:42 - 0:45
    I'll just take Sarah's version and
    add onion powder to it.
  • 0:46 - 0:50
    Then I'll delete both of the other
    versions and save my changes.
  • 0:51 - 0:54
    Finally, I'll let git know that
    the conflict was resolved by
  • 0:54 - 0:57
    adding the chili recipe and committing.
  • 0:58 - 1:00
    As usual, when I merge,
  • 1:00 - 1:03
    Git creates an automatic commit
    message for me, this time letting me
  • 1:03 - 1:08
    know that I've merged the
    remote-tracking branch origin/master.
  • 1:08 - 1:12
    Since running git pull is the same as
    running git fetch and then git merge,
  • 1:12 - 1:17
    I could have run git pull origin master
    and the same thing would have happened.
  • 1:17 - 1:23
    If I run this now, then I can see
    that master is already up-to-date,
  • 1:23 - 1:24
    which makes sense.
  • 1:25 - 1:27
    Now create a merged version
    of your changes and
  • 1:27 - 1:32
    Sarah's changes by running either git
    pull or both git fetch and git merge.
  • 1:34 - 1:36
    Then push the merged
    version up to GitHub.
  • 1:37 - 1:40
    Once you're finished, run git status and
    paste the output in this box.
Title:
New - Merging the Changes Together 2
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
UD775 - How to Use Git and GitHub
Duration:
01:42

English subtitles

Revisions Compare revisions