10 Forking a Repository and Making Changes with Git GUI
Learning Objectives
Understand what it means to fork a repository on GitHub
Successfully fork a repository on GitHub and make changes locally using Git GUI
Identify common errors and learn how to fix them
Step-by-Step Instructions
Part 1: Fork the Repository on GitHub
Navigate to the public repository you want to contribute to. (e.g., https://github.com/vmahan1998/GitHub_Basic_Skills.git)
Click the “Fork button in the top-right corner of the page.
Choose your GitHub account as the destination for the fork.
GitHub will create a copy of the repository under your account.
Part 2: Clone the Forked Repository Locally
Open Git GUI.
Click “Clone Existing Repository”.
Copy the URL of your forked repository from GitHub (e.g.,
https://github.com/yourusername/repo-name.git).Paste the URL into the Source Location field.
Choose a Target Directory and name the folder (e.g.,
repo-name).Click “Clone”.
Part 3: Create New Branch
In Git GUI, go to Branch > Create.
Name your new branch (e.g., fix-typo, feature-new-header, or update-readme).
Click “Create” to switch to the new branch.
Part 4: Make and Commit Changes Locally
Open the cloned folder in File Explorer and make changes to the project files (e.g.,
README.mdor code).In Git GUI, click “Rescan to detect changes.
Stage your changes by clicking “Stage Changed”.
Write a commit message describing your changes and click “Commit”.
Part 5: Push Changes to Your Fork on GitHub
Go to Remote > Push.
Make sure you are pushing to your fork (
new-message) and to the appropriate branch (mainormaster).Click “Push” to upload your changes.
Part 6: Create a Pull Request
Visit your fork on GitHub.
Click “Compare & pull request”.
Add a title and description of your changes.
Click “Create pull request” to submit your contribution to the original repository.
Part 7: Merge Pull Request (for repository maintainers)
In the original repository (or in your fork if you’re an owner), open the pull request.
Click “Merge pull request”.
Confirm by clicking “Confirm”.
After merging, you can safely delete the branch you created.
Video Tutorial
Fork the Repository
Clone the Repository
Create a New Branch and Edit Files
Create a Pull Request
Merge a Pull Request
Troubleshooting
Authentication failed: Use a personal access token (PAT) if prompted for your GitHub credentials.
Remote repository not found: Double-check the URL you copied from your fork.
Unable to push changes: Ensure you are pushing to your fork, not the original repository (you won’t have write access to the original).
Changes not showing in Git GUI: Click Rescan to detect uncommitted changes.
Wrong branch: Make sure you’re working on the correct branch, especially if the original project uses
maininstead ofmaster.