Github: fork a repository and sync the fork

  1. Fork a repository
    • Clone the repository:
      git clone
    • Add the original repository as upstream:
      git remote add upstream
    • Check the status:
      git remote -v
      You will see:
      # origin (fetch)
      # origin (push)
      # upstream (fetch)
      # upstream (push)
  2. Sync the fork with upstream(original):
    • Fetch the branches and their respective commits from the upstream repository:
      git fetch upstream
    • Check out your fork's local master branch:
      git checkout master
    • Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.
      git merge upstream/master
    • Push local repository:
      git push --tags

No comments:

Post a Comment