---
# System prepended metadata

title: Untitled

---

Git 101
* Git 是分散式的版控系統
* 每個人都有一份完整儲存庫副本

1. git add . 加入版空
2. git commit -m "xxx"
3. git log
4. git status 可看出狀態,如：rm/modify
5. working tree 工作目錄 -> on branch master


Create branch
1. git branch xxx 建立分支
2. git checkout branch 切換分支
3. git branch -d xxx 刪除分支
4. git merge xxx 合併分支
5. git reset --hard ORIG_HEAD 回到合併前
6. git branch -d xxx 刪除分支


Vi 101
* vi 退出 (:q)
* i- insert model
* :W- 寫入
* vi tsconfig.json 編輯器

fast-forward
* git merge develop --no--ff 關閉快轉

Section 4 協同作業

遠端下載
1. git clone https:xxxx.git
2. git clone --no-checkout https:xxxx.git xxx (檔名) no checkout 的目的是不要顯示master的所有內容
3. git pull (get the latest version)
4. git pull = git fetch + git merge
5. git clone --bare https:xxxx.git 只下載版控的內容

上傳github

1. git init
2. git push -u origin master
-------------
3. git push 
5. git branch -a (show all remote branch)
6. git push -u origin xxx (upload xxx branch to your github)
7. git push -u origin xxx (publish to remote branch)
8. git fetch (download all remote branch)

遠端分支 遠端追蹤分支 

6. git push origin --delete xxx (delete remote branch(delete branch in github))
7. git fetch --prune (look current remote branch)
8. git brach -d xxx (delete local branch)
9. git remote -h
10. git remote set-url origin https://newplace.git(change to another new github repo)
11. git push -all (upload all local branch to github)
-----------------------------
section 5

working tree -> index (git add .)-> git commit

1. tracked files (inside index)
2. Untracked files (not inside index)
3. stage: index == working tree
4. unstage: index != working tree


















