Django Beginner's Step by Step Tutorial | Build A Portfolio with Django
Beginner
2021-03-23
We show you how to set up your Windows 10 computer for Django development, and build a ...
Date Published: 2021-03-31
Peng Akebuon
In this tutorial, we show you how to Contribute to an Open Source Project using GitHub. In general, we contribute to open-source projects following the fork-and-pull Git workflow
Start by Installing Git on your OS
# Code Snippet
# 1. Fork the repository to your own Github account
#
# 2. Clone the project to your machine
git clone https://github.com/<github-username>/<repo-name>.git
#
# 3. Add Upstream or the remote of the original project to your local repository
# check remotes
git remote -v
git remote add upstream https://github.com/<github-username>/<repo-name>.git
#
# 4. Make sure you update the local repository
# Get updates
git fetch upstream
# switch to master branch
git checkout master
# Merge updates to local repository
git merge upstream/master
# Push to github repository
git push origin master
#
# 5. Create a branch locally with a succinct but descriptive name
git checkout -b branch-name
#
# 6. Commit changes to the branch
# Stage changes for commit i.e add all modified files to commit
git add .
git commit -m "added git commands for "fork-and-pull" Git workflow"
# check status
git status
#
# 7. Following any formatting and testing guidelines specific to this repository
#
# 8. Push changes to your fork
git push origin branch-name
#
# 9. Open a PR in our repository and follow the PR template so that we can efficiently review the changes.
#
# 10. After the pull request was merged, fetch it and update the default branch of your fork
#
#### NB
1. Never Commit on the default branch, commit on branches then make a pull request
2. After making changes, if you want to make another change make sure you branch from the default branch because if you branch from branch-name, this will contain the changes from the 1st pull request except for the new pull request you working on requires the changes from the first pull request
```
# check present branch
git branch
# switch to master branch
git checkout master
# create new branch for new changes
git checkout -b 2nd-test-branch
# make new changes and push to your fork
```
3. After the pull request was merged, fetch the upstream and update the default branch of your fork
####
Let's Connect
🔗 LinkedIn
🔗 Twitter
🔗 Join Our Discord Server
🔗 Academy Omen: GitHub