Using Git 2

From Naevwiki
Jump to: navigation, search

This article describes the steps needed to set up a Github repository in order to push commits. It is assumed you already have Git set up.

Setting up your Naev fork and working copy

  • If you don't already have one, create an account at Github.
  • When your account is ready, navigate to the main Naev repo. This is the repo that official builds are created from. Find the "Fork" button near the top right of the page. Use this button to fork the repo to your own account.
  • Add a public SSH key to your Github account. The steps for doing this are detailed here.
  • If you do not yet have a repo clone on your hard drive, create one now:
git clone git@github.com:$USER/naev.git
  • If you do already have a repo clone on your hard drive, it's a good idea to change your "origin" remote from this repo to your own. The command for this is:
git remote set-url origin git@github.com:$USER/naev.git

Where $USER is your Github account name. This URL should be visible on Github as well, when viewing your fork of the Naev repository. If everything went well, you should now be able to push commits to your own repo. You should also add the Naev repo as a remote, so that you can pull from there when changes are made. To do this, type:

git remote add naev git://github.com/naev/naev.git

After this you can pull with

git pull naev <branch>

Where <branch> is the name of the branch you want. This will usually be master.

Adding your changes to your repo

Below you'll find a few useful commands for adding and changing tracked files.

To add new files to be tracked by git, type

git add <path>

To commit a file or path, type

git commit <path>

To commit all changed files (including files you manually added), type

git commit -a

To push your commits, type

git push origin

Submitting your changes to the Naev team

In order for your changes to be adopted into the main Naev repo, a member of the dev team needs to review your changes and, if there are no objections, merge them.

You can submit your commits via a "pull request". To learn how to submit a pull request, refer to the github help on this topic. Note that Naev operates on the "Fork & pull" model.