如何为 Solo Dev 设置 GIT?

发布于 2024-12-10 23:37:52 字数 649 浏览 0 评论 0 原文

好吧,所以我在这里完全困惑了。我不知道为什么我似乎无法掌握一些 GIT 设置,但我就是不剪它!请有人帮助我。我读过大量教程,但似乎没有什么适合我想要的,所以这让我很困惑。

这是我想做但无法正确完成的事情。

github 上有一个开源项目,它有一个分支(开发),我想抓住它进行改进,然后稍后发布到我自己的服务器上。该存储库是我有权访问的私有只读存储库。我尝试克隆该项目,然后制作 shcnages,但我不知道将它们放在哪里。另外,当 github 项目发生更改时,我仍然不知道如何从 github dev 分支(甚至是 master 分支)正确获取更新,并且不覆盖我自己的东西。

部分混乱在于该项目正在使用 http://nvie.com/ posts/a-successful-git-branching-model/ git-flow 模型让我更加失望。

我正在尝试使用 http://www.git-tower.com/ 来管理 GIT。

是否有一位富有同情心的人可以帮助我,为我提供针对这个特殊情况的一步一步的指导?

Ok, so I have gotten myself completely confused here. I am not sure why I can't seem to grasp some of GITs setup but I am just not cutting it! Please someone help me out. I have read tons of tutorials and nothing seems to fit what I want so it just confuses me.

Here is what I want to do but cannot get it right.

There is an open source project on github that has a branch (development) that I would like to grab to improve on, then at a later time publish to my own server. This repository is private read only which I have access to. I tried cloneing the project then making shcnages but I don't know where to put them. Plus when changes come in from the github project, I still don't get how to grab updates properly from the github dev branch (or even master branch when it gets that far) and not overwrite my own stuff.

Part of the confusion is that the project is using http://nvie.com/posts/a-successful-git-branching-model/ git-flow model which is throwing me off even more.

I am trying to use http://www.git-tower.com/ for managing GIT.

Could some compassionate soul help me by giving me a step by step for this particular instance?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七禾 2024-12-17 23:37:52

我将尝试一步一步地完成此操作,您可以提出问题,以便我可以扩展答案。

  1. 在本地计算机上克隆 github 上的存储库。

    这是使用git clone命令完成的。像 git clone -bdevelopment git://github.com/nibrahim/Xenon-Retroblast.git 这样的东西应该可以做到。此处的 URL 为只读,因为您没有原始存储库的写入权限。我在这里使用我自己的项目之一作为示例。

  2. 这将在Xenon-Retroblast目录中创建一个本地克隆。默认情况下,克隆将指向 master 分支,但您在克隆它时提供的 -b 参数应该会处理这一点。

  3. 现在,在本地进行更改并提交。

  4. 假设您自己的服务器是 hamman.com,并且您在那里设置了一个存储库。您可以使用以下命令将其添加为本地克隆中的remote git remote add myown ssh [电子邮件受保护]:~/repos/project.git。这是您的私人存储库,您可以随意使用它。该存储库的本地名称是 myown。如果您是 github 用户,则此远程可以是 github 上的存储库。您还可以在 github 上单击“fork此项目”并直接在网站上创建一个 fork,从中克隆并将官方存储库添加为远程。

  5. 要将您的提交推送到此存储库,您必须说git push myowndevelopment(将当前分支推送到远程“myown”上的“development”分支)。要从 github 存储库获取,请说 git pull origindevelopment

我确信答案是不完整的,但请提出问题,我希望可以为您充实它。

I'll try to do this step by step and you can ask questions so that I can expand on the answer.

  1. Make a clone of the repository on github on your local machine.

    This is done using the git clone command. Something like git clone -b development git://github.com/nibrahim/Xenon-Retroblast.git should do it. The url here will be read only since you won't have write access to the original repository. I've used one of my own projects here as an example.

  2. This will create a local clone inside theXenon-Retroblast directory. The clone will by default point to the master branch but the -b parameter you gave while cloning it should take care of that.

  3. Now, make your changes locally and commit them.

  4. Let's say your own server hamman.com and you set up a repository over there. You can add that as a remote in your local clone using the following command git remote add myown ssh [email protected]:~/repos/project.git. This is your private repository which you can mess with as you please. The local name of this repository is myown. If you're a github user, this remote can be a repository on github. You can also click "fork this project" on github and create a fork directly on the website, clone from that and add the official repository as a remote.

  5. To push your commits to this repository, you have to say git push myown development (push the current branch to the 'development' branch on the remote 'myown'). To fetch from the github repository, say git pull origin development.

I'm sure that the answer is incomplete but ask questions and I can flesh it out for you hopefully.

柠北森屋 2024-12-17 23:37:52

如果你没有写权限,为什么不先fork该项目呢?

然后您可以创建或修改代码到您自己的分叉项目中。

if you don't have the write permission, why don't you fork the project first?

and then you can create or modify the code into your own forked project.

美胚控场 2024-12-17 23:37:52

您可以从主分支创建补丁,然后将其应用到您自己的分支。但是你必须关注主项目的每一个更改,因为 AFAIK github 不会通知你这些更改。

You can create a patch from master branch, then apply it to your own branch. But you must watch the master project for every changes because AFAIK github doesn't notify you about the changes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文