git
Directory:使用Git管理的一個目錄,也就是一個倉庫,包含我們的工作空間和Git的管理空間。
WorkSpace:需要通過Git進行版本控制的目錄和檔案,這些目錄和檔案組成了工作空間。
.git:存放Git管理資訊的目錄,初始化倉庫的時候自動建立。
Index/Stage:暫存區,或者叫待送出更新區,在送出進入repo之前,我們可以把所有的更新放在暫存區。
Local Repo:本地倉庫,一個存放在本地的版本庫;HEAD會隻是目前的開發分支(branch)。
Stash:是一個工作狀态儲存棧,用于儲存/恢複WorkSpace中的臨時狀态。
git init 建立倉庫(初始化)
git add test.txt 将檔案提至暫存區
git status 檢視版本狀态
git commit -m 将暫存區送出更新 -m 是後面的描述
git log 檢視日志
配置身份
git config --global user.name "coder-pig"
git congif --global user.email "[email protected]"
create a new repository on the command line
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/webws/test.git //遠端連接配接倉庫
origin是别名的設定,第一次連結後 .git/config 裡面的就記錄了origin 就是github的位址
git push -u origin master
push an existing repository from the command line
git remote add origin https://github.com/webws/test.git
git push -u origin master
提示出錯資訊:fatal: remote origin already exists.
解決辦法如下:
1、先輸入$ git remote rm origin
2、再輸入$ git remote add