Open Source Comes to Campus/Curriculum/Directory: Difference between revisions

imported>Shauna
 
(4 intermediate revisions by one other user not shown)
Line 85:
git status
 
You can commitmake sure git is tracking your changes by typing "git add" followed by the files you've changed, for instance:
 
git add index.html
Line 92:
 
git commit -m "I added myself to the directory!"
 
(What's the difference between add and commit, you might ask? "add" let's you specify which specific files you want to include in a commit. If you want to include all the files you've changed you can smoosh these two steps together with <code>git commit -a -m "I added myself to the directory!"</code>)
 
Now, publish those changes on Github by typing:
Line 105 ⟶ 107:
== Create pull request ==
 
ButNow what good is a directory of one? You'llyou want to send your change back to the original repository so it can keep track of all the cool new people making profiles. To do this, you'll want to create what's called a "pull request".
 
Visit your personal fork and click the "Pull requests" button on the right. This will offer you the chance to make a new pull request by clicking on "New pull request". Explain what you did, to make it easier for the repository's maintainer.
Line 117 ⟶ 119:
Sometimes your changes will not show because of caching. To get around this problem, add "?" to the end of the url.
 
== NowYou editcan keep editing your profile ==
 
Now youYou can go backcontinue to youredit localand copyadd and editto your profile. To do this, make changes in index.html by opening it up in your favorite text or code editor. There are html comments next to the sections with text to edit. You should also feel free to make changes to the HTML and CSS, or to add additional images, code, etc as you desire.
 
Once you've made your changes, you can follow [[Open_Source_Comes_to_Campus/Curriculum/Directory#Commit_and_push | the steps above]] to push the changes to your website.
Line 127 ⟶ 129:
= The Follow Up =
 
You might say "Wait! I want a recent copy of thatthe awesome,directory fullwith directoryall forthe mynew ownprofiles sitepeople have added. How do I getdo those changes backthat?"
 
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 166 ⟶ 168:
== Pulling from the original repository ==
 
You want to get the most up to date version of directoryindex.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 willmay 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.
 
<blockquote>If a merge conflict didn't happen this time, you can force it to happen by checking to see the [https://github.com/FOSSdirectory/FOSSdirectory.github.io/commits/master the most recent change] in the original repository. Then, you can make a random edit on the same line as that change. Make sure to add and commit your change before continuing.</blockquote>
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.
 
So now there are two different index.htmls, your local copy and the origin. How do you reconcile the two?
There are two ways to do this. We'll go over both.
 
== Option A: Discard/keep within files ==
Line 191 ⟶ 193:
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 index.html.
 
Luckily, there's a way to to this at the file level:
 
git checkout --theirs directoryindex.html
 
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.
Anonymous user