- Go to the original repository on GitHub.
- Click the Fork button (top right corner). This creates a copy in your GitHub account.
- Open your terminal.
- Clone your forked repository:
Replace
git clone <your_fork_url>
<your_fork_url>
with the URL of your fork (found on your GitHub fork page).
Navigate to the directory of your cloned repository:
cd <repository_name>
Edit the files you want to change using your favorite text editor.
- Stage your changes:
git add .
- Commit your changes:
git commit -m "Your commit message here"
Push your changes to your fork on GitHub:
git push -u origin master
- Go to your forked repository on GitHub.
- Click on Compare & pull request.
- Fill out the details and click Create pull request.
After creating the pull request, add the original repository as a remote called upstream
:
git remote add upstream <original_repo_url>
Replace <original_repo_url>
with the URL of the original repository.
- Switch to your
master
branch:git checkout master
- Pull the latest changes from the upstream repository:
git pull upstream master
If you pulled new updates, push them back to your fork (optional):
git push origin master
# Step 1: Clone your fork
git clone <your_fork_url>
cd <repository_name>
# Step 2: Make changes, then stage and commit
git add .
git commit -m "Your commit message here"
# Step 3: Push your changes
git push -u origin master
# Step 4: Create a pull request (done on GitHub)
# Step 5: Add upstream repository
git remote add upstream <original_repo_url>
# Step 6: Pull latest updates from upstream
git checkout master
git pull upstream master
# Step 7: Push any new updates if needed
git push origin master