0

I have recently been added as a collaborator to a GitHub repository. My question is how do I 'link' my clone of the repository with the remote version, so that my clone stays updated with the remote one (since other people will be making changes to the remote repo). I have been re-cloning the remote repository, but I assume there is a better way to do this. I am using VSCode by the way.

If you couldn't tell, I am new to collaboration/contributing.

0

1 Answer 1

1

You don't need to keep your fork in sync this will happen automatically, when you keep you local git in sync and push them to your fork

# add remote as upstream
git remote add upstream https://github.com/whoever/whatever.git

# fetch changes made to upstream
git fetch upstream

# to update a branch rebase or merge the upstream
git checkout master
git rebase upstream/master

# keep your feature/PR up to date
git checkout feature
git rebase master

# this will also push the new commits on master to your fork
# you may need to use --force-with-lease if you pushed before
git push origin feature

Not the answer you're looking for? Browse other questions tagged or ask your own question.