0
点赞
收藏
分享

微信扫一扫

git 设置 upstream 上游代码库


从gitee.com上fork到自己的gitee账号下

; .git/config 在这个文件追加, 改完了之后git remote -v 查看生效

[remote "upstream"]
url = https://gitee.com/上游组织/上游项目名
fetch = +refs/heads/*:refs/remotes/upstream/*
[user]
name = 我的用户名
email = 我的邮箱

 git branch --set-upstream-to https://gitee.com/company/project
fatal: the requested upstream branch 'https://gitee.com/company/project' does not exist
hint: 
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint: 
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
hint: Disable this message with "git config advice.setUpstreamFailure false"

执行之后,git remote -v 没有改变

所以还是需要改 .git/config配置文件

在项目目录下编辑这个文件

notepad .git/config

如果安装了​​notepad++​​​, ​​下载​​​, 可以改​​cmd alias​​

上游的master合并到本地master

git fetch upstream master
git checkout master
git merge upstream/master

向upstream提交代码,发起pull request

举报

相关推荐

0 条评论