I would just like to seek some help. I've been browsing over stackoverflow and google but somehow cannot find an answer for this. I am collaborating with someone and he is the owner of the remote repo in Github. I forked his repo and then cloned it to my local repo. I started doing my own changes on my local repo, but my question is, if he updates a his side of the repo, how do I update my side without my changes being overwritten?
I'm not sure which command I should use to safely do this. Should I just pull his changes and re-paste the changes I've made? Sorry if this is a stupid question, I am new to collaborating in Github. Thanks in advance!
I started doing my own changes on my local repo, but my question is, if he updates a his side of the repo, how do I update my side without my changes being overwritten?
The sequence of commands would be:
git remote add upstream https://github.com/original/repository
^^^^^^^^^^^^^^^^^^^
replace it with the "someone/repo" name
Then when you want to check if your code works on top of their updated code (assuming said code was pushed on their main
branch):
git fetch upstream
# replay your current branch work on top of their branch
git rebase upstream/main
# check everything work
...
# Then update your own fork
git push --force