Difference between revisions of "BranchingStrategy"

From crowdresearch
Jump to: navigation, search
m (Branching)
Line 12: Line 12:
  
 
<pre>git clone <nowiki>https://github.com/<your-username-here>/crowdsource-platform</nowiki></pre>
 
<pre>git clone <nowiki>https://github.com/<your-username-here>/crowdsource-platform</nowiki></pre>
Setting the upstream on your cloned repository
+
'''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.
 
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  
 
You need to enter the directory by running  
Line 24: Line 24:
 
Now when you are starting to code a new feature, you should create a branch for it. We need to branch out from develop2.
 
Now when you are starting to code a new feature, you should create a branch for it. We need to branch out from develop2.
  
<pre>git checkout develop2   #This switches you to the develop2 branch if you are not already on it.
+
<pre>git checkout develop2
 
git checkout -b feature-branch-name  #The -b option creates a new branch from the branch you're currently on.
 
git checkout -b feature-branch-name  #The -b option creates a new branch from the branch you're currently on.
 
</pre>
 
</pre>
 +
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==
 
==Pushing and pulling==

Revision as of 06:21, 30 May 2015

Forking

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.

Cloning

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

Branching

When 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 branch
to 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   #The -b option creates a new branch from the branch you're currently on.

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

Raising the Pull Request