Skip to content
This repository was archived by the owner on Jun 1, 2021. It is now read-only.

Developers Guide

Cryptocracy edited this page Jul 25, 2017 · 1 revision

Souq currently uses Git for its version control system.

Fork the Souq repository

Forking a repository is a simple two-step process.

  1. On Github.com, navigate to the cryptocracy/souq repository.

  2. In the top-righ corner of the page, click Fork
    Fork

Keep your fork synced

In order to propose changes to the upstream, or original, repository. It's good practice to regularly sync your fork with the upstream repository. To do this, you'll need to use Git on the command line.

Step 1: Setup Git

If you haven't yet, you should first setup Git. Don't forget to set up authentication to Github from Git as well.

Step 2: Create a local clone of your fork

Right now, you have a fork of the Souq repository, but you don't have the files of that repository on your computer. Let's create a clone of your fork locally on your computer.

  1. On Github, navigate to your fork of the Souq repository.

  2. Under the repository name, click Clone or download

Clone or Download

  1. In the Clone with HTTPs section, click Clip Board Icon to copy the clone URL for the repository.

Clone HTTPS

  1. Open Git Bash

  2. Now we need to clone down your fork, first type git clone then paste from your clipboard

    $ git clone https://github.com/Your-Username/souq

Upon Enter your local clone will be created

Cloning into `souq`...
remote: Counting objects: X, done.
remote: Compressing objects: 100% (X/X), done.
remove: Total X (delta 1), reused X (delta 1)
Unpacking objects: 100% (X/X), done.

You now have a local copy of your fork of the Souq repository.

Step 3: Configure Git to sync your fork with the original Souq repository

When you fork the repo, in order to propose changes to the original repo, you can configure Git to pull changes from the original, upstream, repository into the local clone of your fork.

  1. First copy the original Souq repo Clone URL: https://github.com/cryptocracy/souq.git

  2. Open Git Bash

  3. Change Directories into the local folder of the fork you cloned earlier.

    $ cd /path/to/the/clone

  4. Type git remote -v and press Enter. You'll see the currently configured remote repository for your fork.

$ git remote -v
origin https://github.com/Your-Username/souq.git (fetch)
origin https://github.com/Your-Username/souq.git (push)
  1. Type git remote add upstream, and then paste the URL from step 3.1 and press Enter. It will look like this:

$ git remote add upstream https://github.com/cryptocracy/souq.git

  1. To verify the new upstream repository has been set, type git remote -v again. You should see the URL for your fork as the origin, and the URL for the original cryptocracy/souq repository as the upstream.
$ git remote -v
origin https://github.com/Your-Username/souq.git (fetch)
origin https://github.com/Your-Username/souq.git (push)
upstream https://github.com/cryptocracy/souq.git (fetch)
upstream https://github.com/cryptocracy/souq.git (push)

Now you can keep your fork synced with the upstream repository with a few Git commands.

Step 4. Syncing the fork locally

  1. Open Git Bash

  2. Make sure you are in the current working directory of the clone of your fork

  3. First fetch the branches and their respective commits fromt eh upstream repository. Commits to the master will be stored in a local branch, upstream/master.

$ git fetch upstream
remote: Counting objects: X, done.
remote: Compressing objects: 100% (X/X), done.
remote: Total X (delta X), reused X (delta X)
Unpacking objects: 100% (X/X), done.
From https://github.com/cryptocracy/souq
 * [new branch]      master     -> upstream/master
  1. Checkout your fork's local master branch.
$ git checkout master
Switched to branch 'master'
  1. Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes. example
$ git merge upstream/master
Updating a422352..5fdff0f
Fast-forward
 README                    |    9 -------
 README.md                 |    7 ++++++
 2 files changed, 7 insertions(+), 9 deletions(-)
 delete mode 100644 README
 create mode 100644 README.md

If your local branch didn't have any unique commits, Git will instead perform a "fast-forward": example

Updating 34e91da..16c56ad
Fast-forward
 README.md                 |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Tip: Syncing your fork only updates your local copy of the the repository. To update your fork on Github, you must push your changes to it. And then when ready invoke a Pull Requests from your fork back to the original cryptocracy/souq repository.

Step 5. Pushing Changes upto your fork

Step 6. Invoking a Pull Request from your fork to the official Souq repo