Skip to content

Instantly share code, notes, and snippets.

@viko16
Created March 13, 2018 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viko16/3683c3a608eb068937aa9f3af7288d59 to your computer and use it in GitHub Desktop.
Save viko16/3683c3a608eb068937aa9f3af7288d59 to your computer and use it in GitHub Desktop.
同步上游代码

同步上游代码

# 配置 remote 指向上游仓库
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
# 从上游获取
git fetch upstream
# 切回去自己的分支
git checkout master
# 合并到自己的分支上
git merge upstream/master
# push 啦
git push

https://help.github.com/articles/syncing-a-fork/

开源项目贡献代码

# GitHub fork
# git clone 自己 fork 后的仓库
git clone https://github.com/YOU/YOUR_REPOSITORY.git
# 新建自己的功能分支
git checkout -b new-feature
# 完成开发后提交到功能分支
git add xxx
git commit -m "feat: finish xxx"
# 推送到自己的仓库
git push origin new-feature
# 在 GitHub 页面上发起 PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment