Using Git and Github

Using Git and Github#

It’s essential for developers to use Git, especially for open source development. GitHub is a website based on the idea of git.

GitHub not only hosts the source code, but also the documentation, tests, past issues, solutions, and the entire history of changes to the directory. Therefore, you need to have a GitHub account.

Sign into the account, go to seaduck and fork the directory by clicking around.

Note

If you already have a fork, make sure you sync them before cloning it.

Almost ready. Now, let’s get all the files from the repository first.

git clone https://github.com/YourGithubNickname/seaduck.git

Another option is to use the ssh link, which will make things more flexible

git clone git@github.com:YourGithubNickname/seaduck.git

If you use the second option, you will need to set up your github ssh key following this tutorial.

To keep things tidy, it is recommended that you use a new branch of your fork to do the development. You can create that by running (from the seaduck folder):

git checkout -b name_of_your_new_branch

You can now make the changes you want to make in the repository. Checkout this guide on contributing to code and this guide on contributing to documentationfor our recommended practices. Every once a while, run

git add .
git commit -m "Message describing your edits"

This will create a milestone to revert back to. For most developers, running this command also make them feel pretty good.

When you are done with all your changes, or when you just want to keep collaborators updated on what you have done, run

git push -u origin name_of_your_branch

If you go to your directory now, you will find out that you can make a pull request.

When a pull request is created or when new changes are pushed to the pull request, some automatic changes will run. If the runs are not successful, github will send you loads of personal emails, which can be annoying. Therefore, I recommend tidying up before pull request, following this tutorial.