When your instructor makes updates to the original repository, follow these steps to get the latest changes in your forked repository.
Add the original repository as an "upstream" remote:
git remote add upstream https://github.com/osazeejedi/javascript-test.git-
Fetch the latest changes from the original repository:
git fetch upstream
-
Switch to your main branch:
git checkout main
-
Merge the latest changes:
git merge upstream/main
-
Push the updates to your fork:
git push origin main
If you're already on the main branch, you can use:
git pull upstream mainThen push to your fork:
git push origin mainComplete workflow in one go:
git fetch upstream
git checkout main
git merge upstream/main
git push origin main- If you get merge conflicts, resolve them in your code editor, then commit the changes
- If you're unsure which branch you're on, use
git branchto check - If you need to see your remotes, use
git remote -v
Remember:
upstream= the original repository (instructor's repo)origin= your forked repository- Always sync before starting new work to avoid conflicts