Basic git

Adán Sánchez de Pedro Crespo edited this page Jan 19, 2014 · 2 revisions

This guide assumes you are using a POSIX system (GNU/Linux, BSD or Mac OS X). Please send us a mail to support@loqui.im if you require instructions for Windows.

Every time you read USERNAME in this guide, you have to replace it with your own GitHub username.

Forking

To fork this repository, go to https://github.com/loqui/im and press the "Fork" button in the upper right party of the website. After some seconds, your fork should be ready to be cloned and to start working on it.

If you want to change the name of the repository to something more descriptive than "im", you can do so by accessing this page: https://github.com/YOURUSERNAME/im/settings

Cloning

"Cloning" a git repository means downloading a copy of it to your computer so that you can work on it locally. To clone your repository, just run the following command in a terminal emulator:

git clone git@github.com:USERNAME/im.git

Branching

"Branching" a git repository means creating a separate instance of it for working on a specific feature or bug without interfering the work on other issues.

For example, let's suppose you are decided to fix the Issue #666. You'll have to create a branch called fix-for-issue-90 using the following command:

git checkout -b fix-for-issue-666 dev

This will create a new branch called fix-for-issue-666 which will be based upon the dev branch and will switch to it so that you can start solving the issue. HAPPY CODING!

Commiting

Once you think that you have solved the issue or a separate part of it, you are ready to commit the changes. You can run the following command to create a commit containing all the changes that solve the issue #666:

git commit -am "Fixes #666"

Pushing

"Pushing" a branch means to upload all the commits to the origin (the GitHub repository). You can push your fix-for-issue-666 branch using the following command:

git push -u origin fix-for-issue-666

After that, it's a good idea to move back to the dev branch so that you don't mess anything:

git checkout dev

Pull Requesting

"Pull Requests" are useful to tell a repository's owners that you have made some changes in your fork and want to "merge" (apport) them.

Once you have pushed your branch to origin, go to https://github.com/loqui/im. You should see a yellow box suggesting you to make a Pull Request. Press the button to go to the PR creation form. Make sure that it's configured like this:

  • base fork: loqui/im
  • base: dev
  • head fork: YOURUSERNAME/im
  • base: fix-for-issue-666

Use the description text field to explain as best as you can why and what are the changes in the Pull Request.

Then all you have to do is to wait for an owner's review. If you have submitted a Pull Request and after 24h no owners have commented it, ping us (@aesedepece or @Gioyik) and we will take a look the Pull Request as soon as possible.

Optional: Fetching

You can set up your local clone so that you can sync it to the main Loqui repository whenever you want to. To do this, just run this once:

git remote add upstream https://github.com/loqui/im.git

Then, every time you want to sync your repository you can run:

git checkout dev
git fetch upstream
git merge upstream/dev