Anonymous user
Open Source Comes to Campus/Curriculum/Directory: Difference between revisions
Open Source Comes to Campus/Curriculum/Directory (view source)
Revision as of 03:43, 9 March 2014
, 10 years agono edit summary
imported>Shauna No edit summary |
imported>Shauna No edit summary |
||
Line 122:
= The Follow Up =
There's totally a way to do it, but it's kind of complicated. If your mind is already full with the above activity, you should take a break, and come back to this later if you want to.
Line 128:
Alright. Ready?
▲=== Setting multiple remotes ===
The copy of the repository you have on your computer is called your "local" copy. The copy on Github is a "remote". You can see what remotes are associated with your local repository by typing the command:
Line 143 ⟶ 135:
You should see something like this:
origin https://github.com/$yourusername/$your-repository-name (fetch)
origin https://github.com/$yourusername/$your-repository-name (push)
Line 152 ⟶ 145:
git remote add $name $url
Replace $name with whatever you want to label the remote, and $url with the github url for the main repository (that is, <code>https://github.com/FOSSdirectory/FOSSdirectory.github.io.git</code>).
When you do the "git remote -v" command, you should see that you now have two sets of fetch/push listings.
git fetch $name▼
git merge $name/master▼
To update your remote personal repository, you can type:
Line 171 ⟶ 161:
That's it! You can add as many remotes as you'd like, although for the most part people stick to one or two.
===
You want to get the most up to date version of directory.html from the original repository. To get an updated version of the main repository, you can type:
▲ git fetch $name
▲ git merge $name/master
In our case, though, this will cause a merge conflict. A merge conflict happens when two people (or the same person, at two different points in time) edit the same part of the same file. In our case, this happens both in index.html and directory.html. Let's take a moment to think about it.
Your personal repository should have an index.html that's been customized to you. The index.html from the original, however, will only be the blank template version. You want to keep '''your''' index.html. Your directory.html is mostly empty, however, while the directory.html from the original has been updated with links. You want to add '''their''' directory.html.
There are two ways to do this. We'll go over both.
[[File:Merge1.png]]▼
=== Option A: Discard/keep within files ===
To resolve the conflict, scroll through the document until you find sections with these markings. The "========" line separates the two options that are in conflict. Choose which one you want to keep by deleting the other. Then delete all of the markings. Do this for each conflict and then save and exit the file.▼
You will then need to [[Open_Source_Comes_to_Campus/Curriculum/Directory#Commit_and_push | add and commit]] your changes.
=== Option B: Discard/keep whole files ===
Dealing with merge conflicts can get messy, especially when there are a lot of changes and you want to keep things from both versions of the file.
In our case, though, we don't want to take things from each version of the file. We just want to update one file, directory .html.
Luckily, there's a way to to this at the file level:
▲This should result in a conflict. There are a number of tools you can use to help visualize merge conflicts. For simple conflicts, though, I like to use a basic editor, such as nano, vim, emacs, or whatever you're most comfortable with. In basic text view, a merge conflict looks like this:
git checkout --theirs directory.html
▲To resolve the conflict, scroll through the document until you find sections with these markings. The "========" line separates the two options that are in conflict. Choose which one you want to keep by deleting the other. Then delete all of the markings. Do this for each conflict and then save and exit the file.
Again, once you have done this you will need to [[Open_Source_Comes_to_Campus/Curriculum/Directory#Commit_and_push | add and commit]] your changes.
|