Skip to content

How to contribute code

Ron Klinkien edited this page Jan 13, 2022 · 1 revision

How to contribute your code or patches via GitHub

You need to have your own GitHub account.

Visit https://github.com/cyberjunky/3commas-cyber-bots.git

Once there, click on the Fork button in the top-right corner. This creates a new copy of my repository under your GitHub user account with a URL like:

https://github.com/<YourUserName>/3commas-cyber-bots.git

The copy includes all the code, branches, and commits from the original repository.

Next, clone the repository by opening the terminal on your local computer by running the command:

git clone https://github.com/<YourUserName>/3commas-cyber-bots.git

Once the repository is cloned, you need to do two things:

Create a new branch by issuing the command:

git checkout -b new_branch

Create a new remote for the upstream repository with the command:

git remote add upstream https://github.com/cyberjunky/3commas-cyber-bots.git

In this case, "upstream repository" refers to the original repository you created your fork from.

Now you can make changes to the code. The following code creates a new branch, makes an arbitrary change, and pushes it to new_branch:

$ git checkout -b new_branch
Switched to a new branch ‘new_branch’
$ echo “some test file” > test
$ cat test
Some test file
$ git status
On branch new_branch
No commits yet
Untracked files:
  (use "git add <file>..." to include in what will be committed)
    test
nothing added to commit but untracked files present (use "git add" to track)
$ git add test
$ git commit -S -m "Adding a test file to new_branch"
[new_branch (root-commit) 4265ec8] Adding a test file to new_branch
 1 file changed, 1 insertion(+)
 create mode 100644 test
$ git push -u origin new_branch
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 918 bytes | 918.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Remote: Create a pull request for ‘new_branch’ on GitHub by visiting:
Remote:   http://github.com/cyberjunky/3commas-cyber-bots/pull/new/new_branch
Remote:
 * [new branch]         new_branch -> new_branch

Once you push the changes to your repository, the Compare & pull request button will appear in GitHub.

Click it and you'll be taken to a new screen click GitHub's Open pull request button

Open a pull request by clicking the Create pull request button. This allows the repository's maintainers to review your contribution. From here, they can merge it if it is good, or they may ask you to make some changes.