202. Keeping Your Fork Up To Date

변지영·2022년 5월 5일
0

Once you are in your forked project directory in your command prompt....

  1. Type "git remote -v and press Enter. You'll see the current configured remote repository for your fork.
git remote -v
origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)

2.Type "git remote add upstream", and then paste the URL you would copy from the original repository if you were to do a git clone. Press Enter. It will look like this:

git remote add upstream https://github.com/zero-to-mastery/PROJECT_NAME.git
  1. To verify the new upstream repository you've specified for your fork, type "git remote -v" again. You should see the URL for your fork as "origin", and the URL for the original repository as "upstream".
git remote -v
origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

Now, you can keep your fork synced with the upstream repository with a few Git commands.

One simple way is to do the below command from the master of your forked repository:

git pull upstream master
Or you can follow along another method here: "Syncing a fork."

0개의 댓글