Consider your teammate's repository as the upstream repository you will be making a contribution to. Follow the screenshot to fork your upstream repository. If you have multiple account (e.g. in the picture), select an account
-
Clone the repo. Open your terminal. Go to the path where you want to have your repo on your local machine.
-
cd ~/<path where you want to clone your repository>on UNIX/MAC -
cd C:\<path where you want to clone your repository>on Windows -
git clone <repo-name>
Note: You will be cloning the repository which is a fork of your teammate's repository also called upstream in this case.
- Check remote
git remote -v. You should see url of your repository. Something likehttps://github.com/<your_github_account_name>/<repository_name>.gitfor e.g.https://github.com/husky-parul/github-commands.git
-
Add upstream to remote
git remote add upstream <upstream repo link> -
Check remote again
git remote -v. Now you should see two remotes, namelyupstreamandorigin. Verify if the urls are corect.upstreamshould be your teammate's repo url.originshould be your repo url.
- Check current branch
git branch
-
Check the contents of the repo
ls -
Open the file
question.txtand add a sentence,This is my first upstream contribution -
Save the file.
-
Add the file to stage for git to track
git add question.txt -
Make a commit
git commit -m "My first upstream contribution" -
Push the file
git push origin feature-1 -
Verify if the file was pushed by checking it on GitHub web page.







