恭喜你

Git 中级

George Boorman

Curriculum Manager, DataCamp

分支

显示 bug-fix、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...