恭喜你

Git 中級

George Boorman

Curriculum Manager, DataCamp

分支

修補錯誤、ai-assistant 與 main 分支的提交與合併示意圖

Git 中級

操作分支

  • 查看所有分支
git branch
  • 切換到既有分支
git switch hotfix
  • 建立並切換到新分支
git switch -c hotfix
  • 比較兩個分支
git diff main hotfix
  • 重新命名分支
git branch -m hotfix bugfix
  • 刪除分支
git branch -d hotfix
Git 中級

合併分支

  • main,將 ai-assistant 合併進 main
git merge ai-assistant
  • 從其他分支執行:git merge source destination
git merge ai-assistant main
  • 處理合併衝突
Git 中級

操作遠端

  • 複製遠端儲存庫
git clone https://github.com/datacamp/project
  • 取得所有遠端的資訊
git remote -v
  • 新增遠端
git remote add george https://github.com/george_datacamp/repo 
Git 中級

同步本機與遠端儲存庫

git fetch origin
git pull origin
git push origin documentation
Git 中級

接下來呢?

Git 中級

一起來練習吧!

Git 中級

Preparing Video For Download...