协作现有的开源项目 - 如何使用 git / github?

发布于 2025-01-02 16:14:20 字数 260 浏览 1 评论 0原文

我和我的朋友想要开发一个通过 git 托管/工作的开源项目。

我尝试跟踪谷歌上的许多链接,但无法想出一种精确/准确的轻松协作方式。

我们都有 github 帐户,并且希望能够创建一个与我们想要处理(共享)的项目完全相同的分支(或任何名称),然后对其进行更改。因此,当更改准备就绪时,我们可以要求项目人员查看并轻松集成我们的工作。

我们还想跟踪我们在本地结帐时分别做出的更改。这样当它被推送到项目中时,我们就知道谁在做什么。

有人可以指导我吗?

I and my friend want to work on an open source project which is hosted/worked on via git.

I tried to follow many links on google but could not comeup with a precise/exact way of collaborating easily.

We both have github account and want to be able to create a branch (or whatever its called) exactly as that of the project we want to work on (share) and then make changes to it. So when the changes are ready, we can ask the project folks to have a look and integrate our work easily.

We both also want to track what changes we individually make in our local check-out. So that when it get pushed to the project, we know who worked on what.

Can some on please guide me?

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

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

发布评论

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

评论(1

合久必婚 2025-01-09 16:14:20

由于该项目已经存在于 github 上...

要么 1) 添加为协作者,要么 2) “分叉”它,然后提交一个“拉取请求”以进行更改。

接下来,通过单击 github 上的“复制”图标来克隆存储库(如果您是协作者,则可以是主存储库;如果您已分叉,则可以是您用户名下的存储库),然后在本地执行 git clone -paste- (shift-control -v 粘贴到终端窗口中)。

这将获取存储库并制作本地副本,这意味着您通常看到的所有文件以及“幕后”的“实际”git 存储库(通过 .git(隐藏文件)结构)。实际上,您在将文件推送到远程存储库之前添加并提交文件的就是这种结构。

因此,当您是协作者时,您可以推送和拉取到中央存储库,否则它会“发送到”您的分叉。

如果你为所有这些做了一个分叉,你最终会在本地添加/提交你的更改,然后将它们推送到 github(尽管此时这是你的分叉)。您(在 github 中)单击您的分叉页面的“拉取请求”,并向源代码存储库维护者提交通知,表明您有想要提交的更改。

因此,请考虑立即提交代码,当您合作者 - 这时候你可能想要分支(本地),因为你最初可以与主代码库分开进行这些更改,但你仍然可以将这些分支推送到主 github 存储库。
如果您刚刚开始使用这一切,您可能还会发现 gitx (Mac) 或 gitg (Linux) 是实现这一切的令人惊叹的可视化工具。您可以根据需要轻松查看谁在做什么。我称其为“伦敦地下查看器”!

view of gitg/gitx

As the project already exists on github...

Either 1) Get added as collaborators or 2) 'fork' it and then submit a 'pull request' for your changes.

Next, clone the repository (either the main one if you are a collabortor, or the one under your username if you have forked) by clicking on the 'copy' icon on github and then locally do git clone -paste- (shift-control-v pastes in a terminal window).

This gets the repository and makes a local copy which means both all the files that you normally see and also the 'actual' git repository 'behind the scenes' which is through the .git (hidden file) structure. It's actually this structure that you add and commit files to before pushing them to remote repositories.

So when you are a collaborator you can push and pull to the central repository, otherwise it's "to" your fork.

If you do a fork for all this, you end by add/commit your changes locally, then pushing them to github (it's your fork at this point though). They you (in github) click on "pull request" for your fork page and that submits a notice to the source repository maintainer that you have changes you would like to submit".

So think of immediate commits for code that is pushed when you are a collaborator - and THAT's when you probably want to branch (locally) as you can made those changes separately from the main code base initially. You can still git push these branches to the main github repository though.
If you're just getting started with all this you may also find gitx (Mac) or gitg (Linux) to be amazing visual tools for all this. You get to see who worked on what very easily as you require. I called it the 'london undergroud viewer" !

view of gitg/gitx

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