English 字幕

← Committing Changes - How to Use Git and GitHub


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

  1. You've just seen how to add changes to the staging area, so
  2. now let's go over how to create a commit with those changes.
  3. I've just added my changes to cake-recipe.txt and frosting0recipe.txt and
  4. I'm ready to create a commit for them.
  5. To do that, I'll run the command git commit.
  6. And Git opens the editor I've configured so that I can write a commit message.
  7. In my case, the editor is Sublime.
  8. I'll enter the message Add a cake and frosting recipe since that
  9. describes the changes that will be present in this commit.
  10. It's standard Git practice to write your commit message as if it were a command,
  11. which is why I said Add a recipe, rather than Added or Adds a recipe.
  12. Next, I save the file and quit the editor.
  13. And I can use git log to see that the commit has been created.
  14. Here it is.
  15. Now if I run git status again, the initial commit note has gone away and
  16. the only remaining untracked file is chili-recipe.txt.
  17. I'd also like to commit this file in a separate commit and
  18. I can do that using the same process.
  19. Now go ahead and commit the changes in your reflections directory that you
  20. previously added to the staging area.
  21. You can do this using the command git commit.
  22. Then continue committing until you have committed all your changes using git
  23. add, git status and git commit.
  24. What is the output of git status after all your changes are committed?
  25. Paste the output here.