English subtitles

← Committing the Conflict Resolution

Get Embed Code
5 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. I've just resolved the merge conflict
    by moving my change of splitting
  2. the asteroid into two fragments into
    the new breakIntoFragments function.
  3. However, I still need to let git
    know that the conflict is resolved.
  4. I can do this by
    committing the resolution.
  5. First I'll save the file.
  6. Then I'll go back to the command
    line and run git status.
  7. This time, instead of showing
    game.js as simply modified,
  8. git shows the file was both modified.
  9. That's because both branches modified
    the file and then there was a conflict.
  10. I resolved the conflict, though, so
    I'll add the file to the staging area.
  11. Now I'll run git status again, and
    git says, all conflicts are fixed but
  12. you are still merging.
  13. Use git commit to conclude the merge.
  14. So I'll go ahead and
  15. do that, and once again git has already
    filled in a commit message for me.
  16. This time it notes that I just merged
    the master branch into easy-mode, and
  17. that there was a conflict in game.js.
  18. Like before, I could change
    this message if I wanted to.
  19. But this message describes
    the commit well, so
  20. I'll leave the message as it is and
    quit.
  21. Now I'll run git log.
  22. Notice that only one
    new commit was created.
  23. Git didn't create a separate merge
    commit and a conflict resolution.
  24. Instead, it just put them
    both in the same commit.
  25. Now to get practice resolving
    a merge conflict, go and
  26. merge master into easy-mode
    on your own computer.
  27. When you're done,
    run the command, git log -n 1 and
  28. paste the output in this box.
  29. The -n flag means that git log will
    only show that number of commits,
  30. in this case, one.