English feliratok

← New - Merging the Changes Together 2

Beágyazókód kérése
5 Languages

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

  1. Since I've already run git fetch,
    my origin/master will
  2. contain Sarah's changes, which I
    can verify by running git status.
  3. As expected, I see that my branch and
  4. origin/master have diverged and
    have one and one different commit each.
  5. Now I'm ready to merge Sarah's
    changes into my local master.
  6. So, to do that, first I'll make sure
    I have the master branch checked out.
  7. And then I'll run git merge, and
  8. the two branches I want to merge
    are master and origin/master.
  9. Like I expected, I got a merge conflict,
    so I'll open the file and resolve it.
  10. So I can see here's the original version
    before either of us made changes.
  11. Here are my changes
    with onion power added,
  12. and here is Sarah's version
    with cumin removed.
  13. I'll just take Sarah's version and
    add onion powder to it.
  14. Then I'll delete both of the other
    versions and save my changes.
  15. Finally, I'll let git know that
    the conflict was resolved by
  16. adding the chili recipe and committing.
  17. As usual, when I merge,
  18. Git creates an automatic commit
    message for me, this time letting me
  19. know that I've merged the
    remote-tracking branch origin/master.
  20. Since running git pull is the same as
    running git fetch and then git merge,
  21. I could have run git pull origin master
    and the same thing would have happened.
  22. If I run this now, then I can see
    that master is already up-to-date,
  23. which makes sense.
  24. Now create a merged version
    of your changes and
  25. Sarah's changes by running either git
    pull or both git fetch and git merge.
  26. Then push the merged
    version up to GitHub.
  27. Once you're finished, run git status and
    paste the output in this box.