- Go to the top right corner of this page and click on the Fork Button.This creates a new copy of my demo repo under your GitHub user account with a URL like:
https://github.com/<YourUserName>/HacktoberFest2020
- Go to any folder, open terminal and type:
git clone https://github.com/<YourUserName>/HacktoberFest2020
-
Once the repo is cloned, navigate to the Hacktoberfest2020 folder and you need to do two things:
- Create a new branch by issuing the command:
git checkout -b new_branch_name
- Create a new remote for the upstream repo with the command:
git remote add upstream https://github.com/sd2001/HacktoberFest2020
In this case, "upstream repo" refers to the original repo 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:
-
Once you add all the files in your branch, it time to push your code for generating a pull request.
git status
This checks whether you are on your created branch or the master branch. If it shows master, type:
git checkout <Your Branch Name>
Now its time for the Git operations. Always git pull to ensure that your files are updated.
git pull origin master
git add .
git commit -m "Your Message"
git push -u origin <Your Branch Name>
- Once you push the changes to your repo, the Compare & pull request button will appear in GitHub.
- Click it and you'll be taken to this screen:
- Open a pull request by clicking the Create pull request button. This allows the repo'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.