The first thing you need to do is go on to https://github.com/crowdresearch/crowdsource-platform, and click on fork.
A fork is basically a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project. Once you are sure of your changes, you can raise a pull request to merge your changes to the original project.
When you have forked the project, you will find it in your github account.
Now, you want to get this forked repository onto your machine so you can start making changes to the code. Cloning refers to getting the code onto your machine. You can clone a repository by typing this into your command line :
git clone https://github.com/<your-username-here>/crowdsource-platform
Setting the upstream on your cloned repository Once the cloning has been done, we need to tell git what our upstream is, that is, what have we forked from. You need to enter the directory by running
cd crowdsource-platform git remote add upstream https://github.com/crowdresearch/crowdsource-platform.git
BranchingWhen you want to add a new feature or fix a bug—no matter how big or how small—you create a new branch to encapsulate your changes. This makes sure that unstable code is never committed to the main code base, and it gives you the chance to clean up before merging it into the main branch. Type in
git branchto figure out what branch you’re currently working on.
Now when you are starting to code a new feature, you should create a branch for it. We need to branch out from develop2.
git checkout develop2 git checkout -b feature-branch-name
This switches you to the develop2 branch if you are not already on it and then creates a new branch from the current branch.
Pushing and pulling
Now, make your changes. After you're done with your changes, we need to commit them to git.
This will show you a list of all the changes on your local system. Add only the files you want to push and not everything.
git add file1 file2 path/to/file3 file4
After adding all the files you need to, you can double check it by running
git status again.
Next add a commit message using
git commit -m "The commit message describing the change"
Remember, these changes are in your local machine. They haven’t been uploaded to the forked repo in your github account. We need to push our local changes onto that. Before we push the changes, we need to make sure that we pull the updated develop2 from the main repository, because new changes might have been added by others while making your local changes.So we type in
git fetch upstream develop2
This fetches the new changes from the upstream develop2 onto our local machine’s develop2 branch. Next we need to merge the changes from develop2 onto our feature-branch. You need to make sure that you are in the feature branch before you merge.
git merge develop2