Answer a question

I forked the project https://github.com/android/camera-samples a month ago, the forked project is listed as myname/camera in my repo.

Today I find that https://github.com/android/camera-samples has been updated, I fork the project again.

In my mind, the old myname/camera in my repo will be update, but in fact no action im my myname/camera.

Do I must delete myname/camera in my repo first, then fork https://github.com/android/camera-samples for the latest edition?

Answers

You need to sync your fork. The best thing would be to familiarize yourself with the concept of remotes

See all of your remotes via command line:

git remote -v

Before your update (your remotes look like this)

git remote -v
origin  https://github.com/HelloCW/camera-samples (fetch)
origin  https://github.com/HelloCW/camera-samples (push)

After your update (your remote changed)

git remote -v
origin  https://github.com/HelloCW/camera-samples (fetch)
origin  https://github.com/HelloCW/camera-samples (push)
upstream        https://github.com/android/camera-samples (fetch)
upstream        https://github.com/android/camera-samples (push)

You need to add a remote and pull from the upstream repository and push the updates to your fork.

upstream  -->  local clone --> your fork

Follow these steps:

1. Clone your fork (to your local machine):

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository (upstream) in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

3. Updating your fork from original repo to keep up with their changes:

git pull upstream master

Source: https://gist.github.com/CristinaSolana/1885435

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐