This is really important to contribute to other ongoing projects. Here are the steps to follow.
For the demo I will use the private paas git repo.
1. Fork the original git repo to your repository.
You should be able to see the forked repo in your repo list.
2. Now clone the git repo to a directory from your repo.
git clone https://github.com/pubudu538/product-private-paas.git
3. Now go to the cloned directory and use the following command.
git remote -v
As you can see in the output, you have permission to fetch and push changes to your remote git hub repo. Now we are going to add the origin repo which is know as the upstream.
git remote add upstream https://github.com/wso2/product-private-paas.git
The structure of the git repos as follows.
4. Now all is set for you to work around. First of all create a branch called demo. It is better to work in a branch and commit your changes to avoid conflicts.
git checkout -b demo
This command will create new branch called demo and checkout to that branch.
git branch – list down all the branches
git checkout demo – checkout to demo branch
5. Do any changes you want. Use git status command to see the files that have changes.
6. Now commit your changes to local git repo.
git commit -a -m “First commit”-a – Will add the files
-m – Will add the message
“First commit” – Use any commit message you want
7. Now we will push changes to forked repo which is pubudu538/Private-PaaS.
git push origin demo
demo – Branch name
8. Now go to your git hub repo. You will be able to send the pull request.
9. After the pull request is accepted and/or if you want to sync the forked repo with the origin repo, use following commands.
git checkout master – checkout master
git fetch upstream – fetch from upstream
git rebase upstream/master – rebase with master
git push origin master – push changes to forked repoNow your forked repo and origin repo should be even.If you want to send another pull request, start from step 4. I would recommend to start a new branch to avoid conflicts.