我如何分配我自己的GitHub存储库? [英] How can I fork my own GitHub repository?

查看:100
本文介绍了我如何分配我自己的GitHub存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,Git的新手。一直在阅读指南,并认为我有基本知识,但在完成这一目标方面遇到困难。



我为通用标记源代码创建了一个回购协议。只是我重用每一个突破。它被称为 markupDNA.git



我想在我的mac站点有不同的目录dir 〜/站点/项目-N 。我在哪里建立通用的东西,并做一个网站的突破。我希望这些绑定到我的主要git回购作为叉子,但你不能叉自己的回购?



我希望我能做这样的事情:

  git clone< url>名称
git add。
#make changes
git commit -m'whatever'
git push



但我不希望它被推到原点。我希望它推送到克隆它的 markupDNA repo的分支。但它似乎只是把我的改变推到了原点大师身上。我们的想法是保持 markupDNA 干净,并为我的不同项目提供很多分支,每个项目都有自己的克隆目录在我的硬盘上。



有什么想法?

解决方案

而不是使用单独的分支。您仍然可以为每个分支单独签出;只需克隆你的repo多次,然后在每一个中使用 git checkout 将它切换到合适的分支(或者 git checkout -b 创建分支并一次检查出来)。一旦你创建了分支,你可以使用 git push origin< branchname> 将它们推送到GitHub。


So, total newbie to Git. Been reading through the guides and think I have the basics but am having difficulties accomplishing this one goal.

I have a repo created for my generic markup source code. Just stuff I reuse for every breakout. It's called markupDNA.git

I would like to have different directories in my mac sites dir ~/Sites/project-N. Where I build upon the generic stuff and do a breakout of a site. I would like these to be tied to my main git repo as forks, but you cannot fork your own repo?

I wish I could do something like this:

git clone <url> name
git add .
# make changes
git commit -m 'whatever'
git push

But I don't want it to push to origin. I want it to push to a fork of the markupDNA repo whence it was cloned. But it seems like it just pushes my changes right up into the origin master. The idea is to keep the markupDNA clean and just have a lot of forks for my different projects, each of which will have their own cloned dir on my hard drive.

Any ideas?

解决方案

It will probably be a lot easier to use branches, rather than using separate forks. You can still have separate checkouts for each branch; just clone your repo multiple times, and use git checkout in each one to switch it to the appropriate branch (or git checkout -b to create the branch and check it out all at once). Once you have created the branches, you can push them to GitHub using git push origin <branchname>.

这篇关于我如何分配我自己的GitHub存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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