LEARNING JAVASCRIPT - Trang 45

Untracked files:
(use "git add <file>..." to include in what will be committed)

README.md

We now have two changes: one to a tracked file (.gitignore) and one to a new file

(README.md). We could add the changes as we did before:

$ git add .gitignore
$ git add README.md

But this time we’ll use a shortcut to add all changes, then create a commit with all of

those changes:

$ git add -A
$ git commit -m "Ignored all .log files and added README.md."

This is a common pattern you’ll be repeating frequently (adding changes and then

committing them). Try to make your commits small and logically consistent: think of

them as telling a story to someone else, explaining your thought process. Whenever

you make changes to your repository, you’ll be following the same pattern: add one or

more changes, then create a commit:

$ git add -A
$ git commit -m "<brief description of the changes you just made>"

Beginners are often confused by git add; the name makes it seem

like you’re adding files to the repository. Those changes can be new

files, but just as likely they’re changes to files already in the reposi‐

tory. In other words, you’re adding changes, not files (and a new file

is just a special type of change).

This represents the simplest possible Git workflow; if you want to learn more about

Git, I recommend GitHub’s

Git Tutorial

and Jon Loeliger and Matthew McCullough’s

book,

Version Control with Git, Second Edition

.

Package Management: npm

Understanding npm is not strictly necessary to JavaScript development, but it’s

increasingly becoming the package management tool of choice. For Node develop‐

ment, it’s practically essential. Whether you’re actually writing Node apps or just

doing browser development, you’ll find that life is a lot easier with npm. In particular,

we’ll be using npm to install our build tools and transcompilers.
npm comes bundled with Node, so if you haven’t installed Node already, go to the

Node.js home page

and click on the big green “INSTALL” button. Once you’ve

installed Node, verify that npm and Node are functioning on your system. From the

command line, do the following:

ES6 Features | 21

Liên Kết Chia Sẽ

** Đây là liên kết chia sẻ bới cộng đồng người dùng, chúng tôi không chịu trách nhiệm gì về nội dung của các thông tin này. Nếu có liên kết nào không phù hợp xin hãy báo cho admin.