Setup
Clone the remote repository
1
git clone [repository URL]
Nabigate to the project directory
1
cd [repository name]
create your new local branch
1
git checkout -b [your-branch-name]
Push your local branch to the remote repository and set that remote branch as the “upstream” for your local branch.
1
git push -u origin [your-branch-name]
-u
represents--set-upstream
Make code changes and commit
Make Your Code Changes
Edit the files and implement your contribution.Stage and commit Your Changes
1
2git add . or selectedfiles
git commit -m "Describe your changes"
Update your branch to lastest version
Fetch the latest changes from the remote repository
1
2git fetch
# or git fetch origin mainUpdate your local branch to the latest remote main version
1
2
3
4
5
6
7#Update **local** main branch to the latest remote version
git checkout main
git pull
#update your **local** branch to the latest main version
git checkout [your-branch-name]
git merge main
or
1 | git rebase origin/main |
You might handle some conflicts manually in this stage.
Submit
- Push your changes to the remote repository
1
git push
Create a pull request
Go to the repository’s web interface (e.g., GitHub) and initiate a pull request. This will notify the maintainers of your changes, and they’ll review your contribution.Address review feedback
If the project maintainers have feedback or request changes, make the necessary adjustments in your branch and push the updates. The pull request will automatically reflect these changes.