-
Create a fork on github through the UI
Creates a fork that you now own and can modify, add collaborators etc.
-
git clone <fork_address>
Clones the repository like any other github repo that you own
-
git branch
You have a main and can create branches of your own to work off of and merge to main.
-
git remote -v
You can see that origin is pinned to your fork. However, as of right now, your fork can't be updated when updates to the main repository occur. So we need to set an "upstream"
-
git remote add upstream git@github.com:VectorInstitute/PromptEngineering.git
This adds the forked repository as an upstream to our main branch so that we can pull in changes from the original repo when we want to "sync" the fork
-
git remote -v
Now you can see the original repository as an upstream to our fork.
-
git checkout -b <branch_name>
-
Make some changes and commit
-
git push -u origin <branch_name>
Say that there are changes in the main branch of the original repository that you would like to bring in.
-
git fetch upstream
In your fork, we bring in the changes to our fork. They are stored locally as branches named
upstream/main
-
git checkout main
Checkout the main branch to bring in the changes from upstream
-
git merge upstream/main
Merge the new changes into main as you would with a normal merge
Pull requests function quite similarly to a standard pull request on a repository you own. You just have to specify the base repository as well as the target and source branches.