版本管理
背景
# 查看文件内容
$ cat test.txt
git test
git init
git diff
$# 追加新内容到 test.txt 文件
echo "understand how git control version" >> test.txt
# 查看当前文件内容
$ cat test.txt
git test
git init
git diff
understand how git control version
$ 小结
最后更新于
# 查看文件状态
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: test.txt
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: test.txt
$ $ git diff
diff --git a/test.txt b/test.txt
index 729112f..989ce33 100644
--- a/test.txt
+++ b/test.txt
@@ -1,3 +1,4 @@
git test
git init
git diff
+understand how git control version
$ $ git add test.txt
$ $ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: test.txt
$ # 提交到版本库并添加备注
$ git commit -m "add understand how git control version"
[master 36f234a] add understand how git control version
1 file changed, 2 insertions(+)
$ $ git status
On branch master
nothing to commit, working tree clean
$