git切换分支,合并分支,删除分支
切换远程分支
git checkout -b 新分支 origin/master
本地分支关联远程分支
git branch --set-upstream 本地分支 origin/远程分支
也可以:
git fetch origin develop
git checkout -b myfeature origin/develop
如果本地分支已与远程分支关联。当我们运行git fetch命令时,如果远程分支有新的提交,使用git fetch命令会更新本地分支追踪。
建立多个源
git remote add upstream git@github.com:upstream-username/upstream-repo.git
git fetch upstream
git checkout my-branch
git merge upstream/upstream-branch
如果URL是https://github.com/upstream-username/upstream-repo/pull/123,那么提交ID就是123。
git cherry-pick 123
删除远程分支
git push origin --delete 远程分支
参考连接:
https://blog.csdn.net/zhezhebie/article/details/78761417
https://blog.csdn.net/raoxiaoya/article/details/111321583
https://blog.csdn.net/zhouzhiwengang/article/details/124445493
https://geek-docs.com/git/git-questions/503_git_how_to_apply_unmerged_upstream_pull_requests_from_other_forks_into_my_fork.html
浙公网安备 33010602011771号