简体   繁体   中英

Railstutorial git branch edit: how do I “fill” the contents of README.md with the contents of Listing 1.13?

Working with RailTutorial.org on section "1.4.4 Branch, edit, commit, merge", using CLOUD9's online IDE, I made a new git branch as instructed, and renamed the README.rdoc to README.md in my shell. The tutorial explains that I should "fill README.md with the contents of Listing 1.13"

Normally, I would navigate to README.md in the file navigator, open the file, replace the contents of the file with the contents of Listing 1.13, press Ctrl+s to save, and then continue. However, since I am new to git, I want to make sure that the changes I'm making to the file are made the appropriate way.

Am I supposed to edit the file the way I did (finding it in the navigator window, open, edit, save) or am I supposed to change the contents using the unix shell?

I was not certain while making the changes, and then the unix shell output also concerned me because it was somewhat different from the railstutorial, below, specifically, the deletions.

My Output:

 2 files changed, 5 insertions(+), 28 deletions(-)
 create mode 100644 README.md
 delete mode 100644 README.rdoc

RailsTutorial Output:

$ git commit -a -m "Improve the README file"
2 files changed, 5 insertions(+), 243 deletions(-)
delete mode 100644 README.rdoc
create mode 100644 README.md

相信在继续学习本教程的过程中,像上面所做的那样很好。

You can save the file in whatever way you see fit.
Remember, you're not saving the actual file with git. You're saving (in the commits) the actual changes between files.

Typical workflow is:

  1. create file
  2. work on file
  3. save file
  4. stage file changes to index (git add)
  5. store file changes in commit (git commit)

You did ok.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM