Return to Video

Committing the Conflict Resolution

  • 0:00 - 0:04
    I've just resolved the merge conflict
    by moving my change of splitting
  • 0:04 - 0:07
    the asteroid into two fragments into
    the new breakIntoFragments function.
  • 0:09 - 0:12
    However, I still need to let git
    know that the conflict is resolved.
  • 0:12 - 0:15
    I can do this by
    committing the resolution.
  • 0:15 - 0:16
    First I'll save the file.
  • 0:16 - 0:19
    Then I'll go back to the command
    line and run git status.
  • 0:19 - 0:23
    This time, instead of showing
    game.js as simply modified,
  • 0:23 - 0:26
    git shows the file was both modified.
  • 0:26 - 0:29
    That's because both branches modified
    the file and then there was a conflict.
  • 0:29 - 0:33
    I resolved the conflict, though, so
    I'll add the file to the staging area.
  • 0:34 - 0:39
    Now I'll run git status again, and
    git says, all conflicts are fixed but
  • 0:39 - 0:40
    you are still merging.
  • 0:40 - 0:43
    Use git commit to conclude the merge.
  • 0:43 - 0:44
    So I'll go ahead and
  • 0:44 - 0:49
    do that, and once again git has already
    filled in a commit message for me.
  • 0:49 - 0:53
    This time it notes that I just merged
    the master branch into easy-mode, and
  • 0:53 - 0:55
    that there was a conflict in game.js.
  • 0:56 - 0:58
    Like before, I could change
    this message if I wanted to.
  • 0:58 - 1:01
    But this message describes
    the commit well, so
  • 1:01 - 1:03
    I'll leave the message as it is and
    quit.
  • 1:03 - 1:05
    Now I'll run git log.
  • 1:05 - 1:07
    Notice that only one
    new commit was created.
  • 1:08 - 1:12
    Git didn't create a separate merge
    commit and a conflict resolution.
  • 1:12 - 1:14
    Instead, it just put them
    both in the same commit.
  • 1:15 - 1:18
    Now to get practice resolving
    a merge conflict, go and
  • 1:18 - 1:22
    merge master into easy-mode
    on your own computer.
  • 1:22 - 1:25
    When you're done,
    run the command, git log -n 1 and
  • 1:25 - 1:26
    paste the output in this box.
  • 1:26 - 1:31
    The -n flag means that git log will
    only show that number of commits,
  • 1:31 - 1:32
    in this case, one.
Title:
Committing the Conflict Resolution
Description:

03-37 Committing the Conflict Resolution

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

English subtitles

Revisions Compare revisions