git本地倉庫簡單操作
阿新 • • 發佈:2018-12-20
#初始化本地git倉庫
Mac-mini:learn_git wengjianhong$ git init
Initialized empty Git repository in /Volumes/data/1.learning/2.operation/7.tools/1.git/learn_git/.git/
Mac-mini:learn_git wengjianhong$
#編輯檔案
Mac-mini:learn_git wengjianhong$ vim book.list Mac-mini:learn_git wengjianhong$ cat book.list 《http權威指南》 《TCP/IP詳解》 Mac-mini:learn_git wengjianhong$ Mac-mini:learn_git wengjianhong$ git status On branch master No commits yet Untracked files: (use "git add <file>..." to include in what will be committed) book.list nothing added to commit but untracked files present (use "git add" to track) Mac-mini:learn_git wengjianhong$
#提交檔案
Mac-mini:learn_git wengjianhong$ git add book.list Mac-mini:learn_git wengjianhong$ git status On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: book.list Mac-mini:learn_git wengjianhong$ Mac-mini:learn_git wengjianhong$ git commit -m 'add: book.list' [master (root-commit) 44639c6] add: book.list 1 file changed, 2 insertions(+) create mode 100644 book.list Mac-mini:learn_git wengjianhong$
#檢視日誌
Mac-mini:learn_git wengjianhong$ vim book.list
Mac-mini:learn_git wengjianhong$ cat book.list
《http權威指南》
《TCP/IP詳解》
《利用Python進行資料分析》
《Git版本控制管理》
Mac-mini:learn_git wengjianhong$ git add book.list
Mac-mini:learn_git wengjianhong$ git commit -m 'modify: book.list'
[master 6301ac3] modify: book.list
1 file changed, 2 insertions(+)
Mac-mini:learn_git wengjianhong$ git log
commit 6301ac32a61a58b3be01f1c4aa8ae0b86bc9f407 (HEAD -> master)
Author: wengjianhong < [email protected]>
Date: Fri Nov 9 21:20:04 2018 +0800
modify: book.list
commit 44639c6e368e32f464b3bb5db6bc951c8f17779c
Author: wengjianhong <[email protected]>
Date: Fri Nov 9 21:05:16 2018 +0800
add: book.list
Mac-mini:learn_git wengjianhong$ vim book.list
Mac-mini:learn_git wengjianhong$ cat book.list
《http權威指南》
《TCP/IP詳解》
《利用Python進行資料分析》
《Git版本控制管理》
《ansible權威指南》
《架構即未來》
Mac-mini:learn_git wengjianhong$ git add book.list
Mac-mini:learn_git wengjianhong$ git commit -m 'modify: book.list'
[master 2a1d851] modify: book.list
1 file changed, 2 insertions(+)
Mac-mini:learn_git wengjianhong$ git status
On branch master
nothing to commit, working tree clean
Mac-mini:learn_git wengjianhong$git log
commit 2a1d851599330a616a6af9e718ef6d3349ebb173 (HEAD -> master)
Author: wengjianhong <[email protected]>
Date: Fri Nov 9 21:22:14 2018 +0800
modify: book.list
commit 6301ac32a61a58b3be01f1c4aa8ae0b86bc9f407
Author: wengjianhong <[email protected]>
Date: Fri Nov 9 21:20:04 2018 +0800
modify: book.list
commit 44639c6e368e32f464b3bb5db6bc951c8f17779c
Author: wengjianhong <[email protected]>
Date: Fri Nov 9 21:05:16 2018 +0800
add: book.list
Mac-mini:learn_git wengjianhong$