This section describes how to set up a second remote. This is so that you can bring in changes that I do to my basecode, and incorporate them into your repository. The steps roughly would be:
mainSource
.origin
). For example for Lab2 you will set up a local branch Lab2 that “tracks” origin/Lab2
.mainSource
), into a local branch Lab2.mainSource/Lab2
into your local Lab2
.Lab2
to origin/Lab2
.We will now implement these steps:
git remote add mainSource git@gitlab.com:skiadas/WebAppsLabs.git
git checkout -b Lab2 --track origin/Lab2
git fetch mainSource
git merge --ff-only mainSource/Lab2
git push origin Lab2
The first line sets up a new remote. You only need to do it once. In future runs you will just need to run the remaining four lines.
The second line sets up a local branch, called Lab2, to track your remote’s Lab2.
The third line fetches in all updates from my remote branch (mainSource
).
The fourth line merges those updates into your Lab2, but only if those are introducing new commits and nothing else (this is known as fast-forward
).
The fifth line pushes these changes to your remote (origin
). You can do this one from GitKraken as well.