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

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

问题描述

所以,Git 的新手.通读了指南并认为我掌握了基础知识,但在实现这一目标时遇到了困难.

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

我为我的通用标记源代码创建了一个存储库.只是我在每次突破时重复使用的东西.它叫做 markupDNA.git

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

我想在我的 mac 站点目录 ~/Sites/project-N 中有不同的目录.在那里我建立在通用的东西上并突破一个网站.我希望将这些作为 fork 绑定到我的主要 git repo,但您不能 fork 自己的 repo?

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

但我不希望它推送到原点.我希望它推送到克隆它的 markupDNA 存储库的一个分支.但它似乎只是将我的更改直接推送到原始主机.我们的想法是保持 markupDNA 干净,并为我的不同项目提供很多分支,每个分支在我的硬盘上都有自己的克隆目录.

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.

有什么想法吗?

推荐答案

使用分支,而不是使用单独的分叉.您仍然可以为每个分行单独结账;只需多次克隆您的存储库,然后在每个存储库中使用 git checkout 将其切换到适当的分支(或 git checkout -b 以创建分支并检查所有内容)立刻).创建分支后,您可以使用 git push origin 将它们推送到 GitHub.

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天全站免登陆