Git跟踪上游 [英] Git Tracking Upstream

查看:133
本文介绍了Git跟踪上游的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展一个项目,我有一个中央git回购。这个项目是一个骨架,可以成为许多分支的基线。



是否可以配置我的本地工作存储库以便为项目的中心跟踪分支来源和追踪骨架的主人作为一个单独的分支名为上游跟踪骨架的主人樱桃挑选骨架的变化?

我想我的工作流程是东西例如:
$ b

创建骨架>>叉骨架>>骨架从叉2拉动变化>>叉1从骨架拉动变化



是否有更好的流程来完成我所描述的内容? 阅读第3步:配置GitHubFork a Repo的页面(我知道你没有提到GitHub,但它仍然是相关的)




  • origin 是您的远程地址叉,你的本地克隆可以从/推t o

  • 上游是原始仓库的远程地址 Skeleton 可以添加一个 git remote add upstream https://..../Skeleton.git


所以上游不是一个分支。



但是你可以定义一个本地分支,上游回购,使用 git分支

  git branch --set-upstream upstream_master upstream / master 



<但是,你不需要一个本地分支,特别是如果你不会提交新的提交:你可以直接比较你的master和 upstream / master git fetch upstream 之后,选择你需要从 upstream / master


I am working on a project and I have a central git repo. This project is a skeleton to be a baseline for a number of forks.

Is it possible to configure my local working repository for a fork to track the central for the project as origin and track the skeleton's master as a separate branch named upstream tracking the master of the skeleton to cherry pick changes to the skeleton?

I guess I want my workflow to be something like:

Create Skeleton >> Fork Skeleton >> Skeleton Pulls Changes from Fork 2 >> Fork 1 Pulls Changes from Skeleton

Is there a better process to do what I have described?

解决方案

Read the "Step 3: Configure remotes" of the GitHub "Fork a Repo" page (I know you didn't mention GitHub, but it is still relevant)

  • origin is the remote address of your fork, that your local clone can pull from/push to
  • upstream is the remote address of your original repo Skeleton (you can add it with a git remote add upstream https://..../Skeleton.git)

So upstream isn't a branch.

But you can define a local branch which will have for upstream branch the remote tracking branch master from upstream repo, with git branch:

git branch --set-upstream upstream_master upstream/master

However, you don't need a local branch, especially if you won't ever make new commits on it: you can compare your master with upstream/master directly, after a git fetch upstream, cherry-picking what you need from upstream/master.

这篇关于Git跟踪上游的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆