我按照给定的说明(http://octopress.org/docs/setup/)设置了一个Octopress项目,它可以创建一个Github存储库,并在您的机器上创建一个本地存储库.在本地计算机上,将远程添加到原始Octopress存储库,然后发出"git pull"命令.然后,将远程添加到Github存储库,以便将更改推送到存储库.
所有这些都可以工作,但它不会创建原始项目的分支,这意味着没有明显的(以新手)方式向原始Octopress存储库发出拉取请求.
有没有办法让我在Github上添加原始Octopress存储库的分支到我的存储库实例?
如果没有办法,我可以安全地删除我的Github Octopress实例,在Github上分割原文,然后从我的本地存储库添加一个新的远程到新分叉的Octopress吗?
当你创建了一个github-repo并将github-repo添加为远程时
git remote add origin https://github.com/githubname/reponame.git
Run Code Online (Sandbox Code Playgroud)
然后你需要推送你的第一次提交
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
我读过(为什么我需要一直做`--set-upstream`?)这是一个简短的表格
git branch --set-upstream-to my_branch origin/my_branch
git push
Run Code Online (Sandbox Code Playgroud)
什么是上游,我为什么需要设置它?网上几乎没有关于此的信息.我知道有一个类似的话题'git remote add upstream'帮助实现了什么?,但在我看来,它并没有准确解释上游是什么以及什么git push -u origin master做,特别是origin master指出的是,它是本地回购还是远程回购?
我们有一个项目,主要是通过复制/粘贴方法分解.但是回购之间仍然存在重大的重叠.
是否可以追溯性地将此fork标记为github的fork,以便比较和pull请求等函数能做正确的事情?
注意:我尝试了下面的"hack",重新分叉,克隆fork,复制"forked"内容,然后git add/commit/push.但是,原始"fork"中的文件历史记录丢失了,并且分支不会过来.
我正在尝试使用我的featureA分支,同时使其与主分支保持同步.
这是场景
git clone ssh://xxx/repo
git checkout -b featureA
$ git add file.txt
$ git commit -m 'adding file'
$ git push origin featureA
Run Code Online (Sandbox Code Playgroud)
同时有几个新的提交被推到了原点大师
git checkout master
git pull origin master
git checkout featureA
git rebase master
git push origin feature A
To ssh://xxx/repo
! [rejected] featureA -> featureA (non-fast-forward)
error: failed to push some refs to 'ssh://xxx/repo'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See …Run Code Online (Sandbox Code Playgroud)