git學習筆記(1)
阿新 • • 發佈:2018-12-06
1 配置
啟動 git bash
[email protected] MINGW64 ~
$ git config --global user.name "tzb"
[email protected] MINGW64 ~
$ git config --global user.email "[email protected]"
檢視配置
$ git config --list
2 GUI 介面Sourcetree
https://www.sourcetreeapp.com/
2.1 建立新倉庫
2.2 命令列模式
[email protected] MINGW64 /d/Data/sourcetree/demo1 (master)
$ pwd
/d/Data/sourcetree/demo1
[email protected] MINGW64 /d/Data/sourcetree/demo1 (master)
$ ll
total 1
-rw-r--r-- 1 tzb 197121 10 11月 29 16:21 hello.txt
[email protected] MINGW64 /d/Data/sourcetree/demo1 (master)
$ cd ..
[email protected] MINGW64 /d/Data/sourcetree
$ ls
demo1/
[email protected] MINGW64 /d/Data/sourcetree
$ mkdir demo2
[email protected] MINGW64 /d/Data/sourcetree
$ cd demo2
[email protected] MINGW64 /d/Data/sourcetree/demo2
$ git init
Initialized empty Git repository in D:/Data/sourcetree/demo2/.git/
[email protected] MINGW64 /d/Data/sourcetree/demo2 (master)
$ ls -a
./ ../ .git/
[email protected] MINGW64 /d/Data/sourcetree/demo2 (master)
$ echo "Hello World 2" >> test2.txt
[email protected] MINGW64 /d/Data/sourcetree/demo2 (master)
$ git add test2.txt
warning: LF will be replaced by CRLF in test2.txt.
The file will have its original line endings in your working directory.
[email protected] MINGW64 /d/Data/sourcetree/demo2 (master)
$ git commit -m "repo2 first commit"
[master (root-commit) e51b4d9] repo2 first commit
1 file changed, 1 insertion(+)
create mode 100644 test2.txt
[email protected] MINGW64 /d/Data/sourcetree/demo2 (master)
$ git status
On branch master
nothing to commit, working tree clean
3 Git倉庫
- 初始化版本庫
git init
- 新增檔案到版本庫
git add
,git commit
- 檢視倉庫狀態
git status