Git Basics
Installing Git
To fork/clone a project on Github or Gitorious
- Start out logged in to Github or Gitorious
- Visit the project you want to fork/clone
- Click the "Fork" (GitHub) or "Clone" (Gitorious) button in the top-right
- Wait for the animation to conclude
- Notice that your browser is now visiting a copy of the project in your personal space, rather than the old, group-owned one. You should also see a "forked from..." remark in the top-left.
Now, clone to it to your computer
- On the page, find the clone URL which starts with "git@"
- Copy the URL to the clipboard
- Open a terminal and type: "git clone " (including the space, but not including the quotation marks)
- Use your terminal to "paste" the URL in. (Make sure it starts with https; if not, it is likely to cause problems unless you have SSH keys set up.)
- Press enter to do the "git clone" operation.
- Once you've done that, "cd" into the directory.
Make changes
- Make changes to the repository using whatever tools you usually use and whatever the project specifies. You can access files in a git repository the same way you'd access any other files on your computer.
Commit and push
Once you're finished making changes, you can use the following command to get a list of files you've changed:
git status
You can commit your changes by typing "git add" followed by the files you've changed, for instance:
git add index.html
Once you've added the changes, you can "commit" them with a message specifying what you've changed.
git commit -m "Explanation of my changes"
Now, publish those changes on Github by typing:
git push
You will be prompted for your username and password. (If you find constantly entering your username and password annoying, there's an alternate method we can show you called SSH.)
(Alternatively, you may be prompted to set your name and email address. This means you missed a step in setting up git. No worries, you can set them now.)
You can now visit Github/Gitorious and make sure your personal fork contains those changes.
Create pull request
Visit your personal fork and click the "Pull requests" button on the right (GitHub) or the "Request Merge" button (Gitorious). This will offer you the chance to make a new request by clicking on "New pull request" (GitHub) or direct to the form (Gitorious). Explain what you did, and leave a remark that this relates to any issue tracker issues or pages that prompted you to contribute.
Now, get feedback from the project's maintainer and eagerly await your request getting merged!