Difference between revisions of "Working With Git"

From Avogadro - Free cross-platform molecule editor
Jump to: navigation, search
m
(Added more details about working with Git)
Line 25: Line 25:
  
 
Make any changes you like, commit them to your local repository and then use git format-patch to make a patch. When the patch is applied it goes into Git just like any other commit and you get full credit. For this reason you should ensure you set up your name and email correctly before committing anything.
 
Make any changes you like, commit them to your local repository and then use git format-patch to make a patch. When the patch is applied it goes into Git just like any other commit and you get full credit. For this reason you should ensure you set up your name and email correctly before committing anything.
 +
 +
== Contributing to Avogadro ==
 +
 +
If you would like to get more involved with Avogadro, and begin making contributions to our code on a longer term basis, you should take the following steps:
 +
 +
* Create an account on [http://github.com/ GitHub].
 +
* Go to the [http://github.com/cryos/avogadro/ Avogadro repository] and click on the fork button.
 +
* Clone your forked repository to your local machine.
 +
* It is often convenient to make a topic branch for individual features or fixes, <tt>git checkout -b newfeaturebranch master</tt>.
 +
* Make any changes you want to make, commit them and do a <tt>git push</tt>.
 +
* Make a pull request to cryos, see the [http://github.com/guides/pull-requests GitHub guide to pull requests].
 +
 +
While getting used to Git there are several guides such as [http://github.com/guides/git-cheat-sheet the Git cheat sheet], [http://github.com/guides/fork-a-project-and-submit-your-modifications forking and submitting modifications], and [http://github.com/guides/keeping-a-git-fork-in-sync-with-the-forked-repo keeping a git fork in sync with upstream]. You can also ask questions on IRC or our mailing list.

Revision as of 22:46, 30 December 2008

In December 2008 Avogadro moved its version control system over to Git, hosted at GitHub. Git is quite different to traditional, centralized version control systems. It is a DVCS (Distrubuted Version Control System). It was coded by Linus Torvalds and others primarily to handle the Linux kernel's very distributed development model.

There are lots of guides around that help you to work with Git. A good quick start guide is everyday Git. In a normal workflow we recommend that you sign up for a GitHub account, go to the Avogadro GitHub page and fork Avogadro. You will then get your own copy of the Git repository. You can keep this up to date using the web interface or Git, and can make pull requests when your changes are ready for integration.

Configuring Git

The first thing you will want to do is tell Git who you are. This will be used in commit messages and attributions.

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

If you are like me you may also want to add some color to the Git output.

git config --global color.branch true
git config --global color.diff true
git config --global color.interactive true
git config --global color.pager true
git config --global color.status true

One or Two Patches

If you just have one or two patches you would like to submit you probably just want to clone our repository.

git clone [email protected]:cryos/avogadro.git

Make any changes you like, commit them to your local repository and then use git format-patch to make a patch. When the patch is applied it goes into Git just like any other commit and you get full credit. For this reason you should ensure you set up your name and email correctly before committing anything.

Contributing to Avogadro

If you would like to get more involved with Avogadro, and begin making contributions to our code on a longer term basis, you should take the following steps:

* Create an account on GitHub.
* Go to the Avogadro repository and click on the fork button.
* Clone your forked repository to your local machine.
* It is often convenient to make a topic branch for individual features or fixes, git checkout -b newfeaturebranch master.
* Make any changes you want to make, commit them and do a git push.
* Make a pull request to cryos, see the GitHub guide to pull requests.

While getting used to Git there are several guides such as the Git cheat sheet, forking and submitting modifications, and keeping a git fork in sync with upstream. You can also ask questions on IRC or our mailing list.