Dream4ever / Knowledge-Base

record every requirement and solution here
https://www.hewei.in/
36 stars 6 forks source link

命令行方式将 fork 项目与上游项目同步 #182

Closed Dream4ever closed 2 years ago

Dream4ever commented 2 years ago

搜索路径

关键词:git forked repository update from original repository

解决方案

How do I update or sync a forked repository on GitHub?

主要流程

# 1. 添加上游项目
git remote add upstream https://github.com/whoever/whatever.git

# 2. 获取上游项目所有分支
git fetch upstream

# 3. 自己 fork 出来的项目切换到主分支
git checkout main

# 4. rebase 自己的分支
git rebase upstream/master