A fork is a personal copy of someone else’s project that lives on your GitHub account. Forking a repository allows you to freely experiment with changes without affecting the original project. GitHub provides an easy way to fork repositories and contribute to open-source projects.
// Clone your forked repository to local machine
git clone <repository-url>
// Create and switch to a new branch
git checkout -b feature-branch
// Stage all changes
git add .
// Commit changes with a message
git commit -m "Add new feature"
// Push branch to your fork
git push origin feature-branch
// Add original repo as upstream
git remote add upstream <original-repository-url>
// Fetch latest changes
git fetch upstream
// Merge upstream main branch
git merge upstream/main