如何使用git修改开源项目并让其他人更新项目而不丢失我的更改

发布于 2024-09-17 09:51:00 字数 356 浏览 5 评论 0原文

因此,我想对 status.net(开源 Twitter 克隆)进行一些更改。

假设我想让人们可以在他们的“推文”中添加字体。

但是,我想继续从 status.net 人员那里获取更新...假设他们进行了一些更改并修复了一些安全漏洞或添加了新的辅助功能。

所以,我会想要

git clone <url to status.net repo>

然后,什么? :)

我如何进行更改,将它们正确存储在 git 中,并与来自“网络”的新更改正确合并(?)?

与“(在此处进行更改)”交织在一起的一系列命令将对我有很大帮助。

谢谢!

So, I'd like to make some changes to status.net (an open source Twitter clone).

Let's say I want to make it so that people can add fonts in their 'tweets', hypothetically.

But, I want to keep getting updates from the status.net people...Let's say they make some changes and fix some security holes or add a new auxiliary feature.

So, I'll want to

git clone <url to status.net repo>

Then, what? :)

How do I make my changes, store them in git properly, and merge(?) properly with new changes coming from the 'net?

A sequence of commands, interwoven with "(make your changes here)" would help me a lot.

Thanks!

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

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

发布评论

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

评论(3

长伴 2024-09-24 09:51:00

要做出改变,你首先要戴上程序员的帽子,做你一直做的事情。我真的无法帮助您:-)

接下来,您需要提交更改。要提交,只需说:

$ git commit -a # -a means "automatically stage all changed files git knows about"

并在提示符处键入描述性消息。请注意,git 中的“提交”不会公开您的更改。它只是提交到您的存储库的本地副本;直到你将来 git Push 之前,没有人会看到它。

要将其他人对您的存储库副本所做的更改合并:

$ git pull

如果您可以直接访问存储库,则可以将您之前所做的 git commit 向公众公开:

$ git push

否则,您可以将您提交的补丁并将其发送给友好的维护人员:

$ git log
commit 75b17eeca0394e27759acf2f6b039851a5a28f98
Author: Your Name 
Date:   Tue Aug 10 01:10:19 2010 -0400

    Did something wonderful.

commit f9f677a465a5746874dc2f2c86cc444ffa28a020
Author: Your Name 
Date:   Fri Aug 6 04:06:01 2010 -0400

    Fixed a horrible horrible error of mine.

$ git show 75b17eeca0394e27759acf2f6b039851a5a28f98 > wonderful.diff
$ git show f9f677a465a5746874dc2f2c86cc444ffa28a020 > fix.diff

最后,如果您想向存储库添加新文件,请说:

git add foo.html # don't forget to git commit -a like you would any change

要删除文件,您只需像平常一样删除它们即可(使用 rm > shell 命令),然后 git commit -a 进行更改。

To make changes, you first put on your programmer hat and do what you always do. I really can't help you there :-)

Next, you'll want to commit your changes. To commit, just say:

$ git commit -a # -a means "automatically stage all changed files git knows about"

and type a descriptive message at the prompt. Note that "commit" in git does not make your changes public. It merely commits to your local copy of the repository; nobody sees it until you git push in the future.

To merge changes other people made into your copy of the repository:

$ git pull

If you have direct access to the repository, you can make the git commits you did earlier available to the public with:

$ git push

Otherwise, you can convert your commits into patches and send them to your friendly maintainer:

$ git log
commit 75b17eeca0394e27759acf2f6b039851a5a28f98
Author: Your Name 
Date:   Tue Aug 10 01:10:19 2010 -0400

    Did something wonderful.

commit f9f677a465a5746874dc2f2c86cc444ffa28a020
Author: Your Name 
Date:   Fri Aug 6 04:06:01 2010 -0400

    Fixed a horrible horrible error of mine.

$ git show 75b17eeca0394e27759acf2f6b039851a5a28f98 > wonderful.diff
$ git show f9f677a465a5746874dc2f2c86cc444ffa28a020 > fix.diff

Lastly, if you want to add new files to the repository, say:

git add foo.html # don't forget to git commit -a like you would any change

To remove files, you can simply remove them like you normally would (with the rm shell command), then git commit -a the change.

凉世弥音 2024-09-24 09:51:00

以下链接似乎处理了所有细节:
http://status.net/wiki/IntroToUsingGit

目前尚不清楚您是否需要其他查看您的存储库,以及您是否希望最终将更改推送回 status.net 主 git 存储库,以便集成商将您的更改合并到主干中。

The following link seems to deal with all the details:
http://status.net/wiki/IntroToUsingGit

It is not clear at this point if you want others to see your repository and if you want to eventually push you changes back to status.net main git repository in order for an integrator to merge your changes in the main trunk.

留蓝 2024-09-24 09:51:00

除非您是值得信赖的开发人员,否则您可能无法将更改推送回来。在这种情况下,您将向他们发送“拉取请求”。本文告诉您如何做到这一点: http://www.kernel.org/pub/software/scm/git/docs/git-request-pull.html

You might not be able to push your changes back up unless you are a trusted developer. In that case you'll seed to send them a "pull request". This article tells you how to do just that: http://www.kernel.org/pub/software/scm/git/docs/git-request-pull.html

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