开发者

How to use git to modify an open source project and let other people update the project without losing my changes

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.

B开发者_StackOverflowut, 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!


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜