Commit 0b621fb4 authored by TheNumbat's avatar TheNumbat
Browse files

update git instructions

parent fcbe527d
...@@ -34,13 +34,15 @@ The easiest (but not recommended) way is to download a zip from GitHub and make ...@@ -34,13 +34,15 @@ The easiest (but not recommended) way is to download a zip from GitHub and make
- Add a new remote called `origin`: - Add a new remote called `origin`:
- `git remote add origin https://github.com/your_id/MyScotty3D.git` - `git remote add origin https://github.com/your_id/MyScotty3D.git`
- We can now push the starter code to our private copy: - We can now push the starter code to our private copy:
- `git push origin -u master` - `git push origin -u main`
5. Congratulations! you have successfully _mirrored_ a git repository with all past commits intact. Let's see a case where this becomes very useful: we start doing an assignment and commit regularly to our private repo (our `origin`). Then the 15-462 staff push some new changes to the Scotty3D skeleton code. We now want to pull the changes from our `sourcerepo`. But, we don't want to mess up the changes we've added to our private copy. Here's where git comes to the rescue: 5. Congratulations! you have successfully _mirrored_ a git repository with all past commits intact.
Now, let's see why this setup may be useful: say we start doing an assignment and commit regularly to our private repo (our `origin`). Then the 15-462 staff push some new changes to the Scotty3D skeleton code that we want to pull in. But, we don't want to mess up the changes we've added to our private copy. Here's where git comes to the rescue:
- First commit all current changes to your `origin` - First commit all current changes to your `origin`
- Run `git pull sourcerepo master` - this pulls all the changes from `sourcerepo` into your local folder - Run `git pull sourcerepo master` - this pulls all the changes from `sourcerepo` into your local folder
- If there are files that differ in your `origin` and in the `sourcerepo`, git will attempt to automatically merge the changes. Git may create a "merge" commit for this. - If there are files that differ in your `origin` and in the `sourcerepo`, git will attempt to automatically merge the changes. Git may create a "merge" commit for this.
- Unfortunately, there may be merge conflicts. Git will handle as many merges as it can, and then will then tell you which files have conflicts that need manual resolution. You can resolve those conflicts in your text editor and create a new commit to complete the `merge` process. - Unfortunately, there may be merge conflicts. Git will handle as many merges as it can, then then tell you which files have conflicts that need manual resolution. You can resolve the conflicts in your text editor and create a new commit to complete the `merge` process.
- After you have completed the merge, you now have all the updates locally. Push to your private origin to include the changes there too: - After you have completed the merge, you now have all the updates locally. Push to your private origin to publish changes there too:
- `git push origin master` - `git push origin main`
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment