ls // 列出所處資料架內所有檔案與資料夾
mkdir "資料夾名稱" // 建立命名的資料夾
cd "資料夾名稱" // 進入指定資料夾
touch "檔案名稱" // 建立命名的檔案
code . // 打開VS Code編輯器
git log --online // 查看 遠端、本地最後一個節點的狀況
git log --online --graph --all // 查看所有 git 線圖
git remote add "遠端位置" "遠端repo網址" // github repo或heroku repo都能用
git push "遠端位置" "分支名稱" // 例如:git push origin R01 => 把本地的R01分支push到origin遠端位置
git clone "github repo網址" // 下載repo到本地
git fetch "遠端位置" "分支名稱" // 查看遠端位置或分支有無更新,例如:git fetch origin
git merge "遠端位置" "分支名稱" // 合併遠端分支內容到本地所在分支,會自動生成一個merge的commit
git pull "遠端位置" "分支名稱" // 相當於fetch + merge,會自動生成一個merge的commit
git add .
git commit -m "更改檔案紀錄文字"
git rebase -i "前一個commit節點" // *重要! 在本地整理commit節點和訊息後再push到遠端
git reset HEAD^ // 後悔前一個commit紀錄,會保留所有檔案修改,但退回commit和add狀態
git branch // 查看所有分支和**目前所在分支位置**
git branch ****"分支名稱" ****// 新增分支
git branch -v // 查看各個分支的最新 commit
git branch --all //查看本地、遠端分支
git branch -m feature/a feature/abc //重新命名分支. 原本的分支名稱 新的名稱
git checkout "分支名稱" // 切換分支,例如:git checkout R03 => 移動到R03分支編輯檔案
git checkout -b "分支名稱" // 創立新分支並移動到分支
git merge "分支名稱" // 把分支內容合併到現在分支,例如:git merge origin/R03-test => 若目前位置是R03,則是讓位於origin遠端位置的R03-test分支內容合併進本地R03分支
git merge --no-ff //合併分支不要快轉
// 改分支名稱方法兩種,建議push到github前檢查一下名稱
// 1. 移動到要改名的分支後,例如:git checkout R03
git branch -m "新的分支名稱" // 例如:git branch -m Front03
// 2. 移動到主幹(main or master)上後,例如:git checkout master
git branch -m "舊的分支名稱" "新的分支名稱" // 例如:git branch -m R02 Back02
git clone <https://github.com/wuwachon/twitter-api-2020>
git remote -v // 確認遠端連線,預計專案完成後會有origin、upsteam、heroku等遠端位置
// Initial Project 遠端位置顯示如下 origin https://github.com/wuwachon/twitter-api-2020 (fetch) origin https://github.com/wuwachon/twitter-api-2020 (push)
git remote add upstream <https://github.com/ALPHACamp/twitter-api-2020.git>
git fetch upstream // 到SourceTree看線圖有沒有更新
git merge upstream/master // 若顯示有更新,合併新版程式碼
git install