Fork the project to your github account
Clone the project to you local environment
git clone ssh_string local_directory
In order to keep in sync with the official repo
git remote add upstream ssh_string(official repo)
Get information about that remote
git fetch upstream
You need to point your master to the upstream/master (official)
git branch --set-upstream-to=upstream/master master
The remote copy of the repo in your account is called origin
Before making any changes to the project, you should review the contributing.md file or the readme.md or wiki in order to know how to set-up the project development environment, coding standards and contributing guidelines.
Next, you should make your changes in a brand new branch
git checkout -b pr/{branch_name}
Follow the instructions in order to set-up the project in your local environment. Instructions may differ from project to project.
Once the changes have been added, you need to commit them.
git add .
git commit -m "comments go here"
Now it's time to update your fork
git push origin pr/{branch_name}
Or
git push --set-upstream origin pr/{branch_name}
git push -u origin pr/{branch_name} #short version
git push
In github, go to the original repository and create a new PR. You need to select the master
branch in the original repo and the branch name you created in your own fork. Then, you need to wait for one of the project's maintainers to respond to your PR.
Most open source projects have CI tools set-up so tests run automatically when a new PR is created. Code coverage tools are also used to report whether new/changed code is covered by the test suite or not.
In order to avoid Git hooks (client and/or server) you can use the --no-verify
option of the git commit
command.
git commit -m "some commit message" --no-verify
If the original repo has changes our fork does not, there is probably a good idea to use the rebase
option in order to update your PR with the latest changes and apply your commits to the new version.
git fetch upstream
git rebase upstream/master
If there are conflicts between our changes and the latest ones from the upstream
, you can use diff
to see what the conflicts are
git diff
Fix those conflicts manually, then execute the following to continue with the rebase
operation
git rebase --continue
If all you want to do is revert the rebase
you can use the following command
git rebase --abort