Created
December 10, 2024 11:52
-
-
Save vprasadreddy/5b02b36248beab20be4592eac2dfbe71 to your computer and use it in GitHub Desktop.
sync changes from the parent repository into your forked repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To sync changes from the parent repository into your forked repository, you can follow these steps: | |
| 1. Configure the parent repository as a remote | |
| First, you need to ensure that the original (parent) repository is added as a remote in your local repository. This is typically named upstream. | |
| # Navigate to your forked repository's directory | |
| cd path/to/your/repo | |
| # Add the parent repository as 'upstream' remote | |
| git remote add upstream https://github.com/parent-repo/parent-repo.git | |
| Replace the URL with the URL of the parent repository. | |
| 2. Fetch the latest changes from the parent repository | |
| Fetch the changes from the upstream remote repository (parent repo). | |
| git fetch upstream | |
| 3. Merge changes into your local branch | |
| Merge the changes from the upstream remote (typically the main or master branch) into your local branch. You can either merge or rebase. | |
| Option 1: Merge changes | |
| git merge upstream/main | |
| or if the default branch is master: | |
| git merge upstream/master | |
| Option 2: Rebase (optional) | |
| Rebasing applies the changes on top of your existing changes, which might give a cleaner history. | |
| git rebase upstream/main | |
| 4. Push the merged/rebased changes to your fork | |
| After merging or rebasing, push the changes back to your fork on GitHub. | |
| git push origin main | |
| This will update your forked repository with the latest changes from the parent repo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment