Untracked files: (use "git add <file>..." to include in what will be committed)
images/ index.html
nothing added to commit but untracked files present (use "git add" to track) # 通过git add命令使得git可以管理index.html和images文件 $ git add index.html images warning: LF will be replaced by CRLF in index.html. The file will have its original line endings in your working directory. # 再次查看git管理情况 $ git status On branch master
Initial commit
Changes to be committed: (use "git rm --cached <file>..." to unstage)
new file: images/git-logo.png new file: index.html # 看到已经将images和index.html添加到git仓库的暂存处
通过浏览器打开本地的index.html文件,如下图所示
# 创建styles目录 $ mkdir styles # 将style.css复制到仓库中的styles目录下 $ cp ../git_learning_master_6_commits-27d2f8146eabcf2782e87ce445b8469cc1accc73/styles/style.css styles/ $ git status On branch master
Initial commit
Changes to be committed: (use "git rm --cached <file>..." to unstage)
new file: images/git-logo.png new file: index.html
Untracked files: (use "git add <file>..." to include in what will be committed)
styles/ # 将styles目录添加到暂存区,让git管理起来 $ git add styles warning: LF will be replaced by CRLF in styles/style.css. The file will have its original line endings in your working directory. $ git status On branch master
Initial commit
Changes to be committed: (use "git rm --cached <file>..." to unstage)
new file: images/git-logo.png new file: index.html new file: styles/style.css
添加了css文件后,刷新网页
# 添加js目录 $ mkdir js # 复制动画文件 $ cp ../git_learning_master_6_commits-27d2f8146eabcf2782e87ce445b8469cc1accc73/js/script.js js $ git status On branch master
Initial commit
Changes to be committed: (use "git rm --cached <file>..." to unstage)
new file: images/git-logo.png new file: index.html new file: styles/style.css
Untracked files: (use "git add <file>..." to include in what will be committed)
js/ # 将js目录添加到暂存区 $ git add js warning: LF will be replaced by CRLF in js/script.js. The file will have its original line endings in your working directory. # 查看状态 $ git status On branch master
Initial commit
Changes to be committed: (use "git rm --cached <file>..." to unstage)
new file: images/git-logo.png new file: index.html new file: js/script.js new file: styles/style.css
footer p{ margin-bottom:0; } $ vim styles/style.css $ vim index.html $ git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)
modified: index.html modified: styles/style.css
no changes added to commit (use "git add" and/or "git commit -a") # 将所有变更保存到暂存区 $ git add -u $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage)