Updating the Contact List Tutorial

On Wednesday, October 20, 2010 0 comments

Do not attempt this tutorial before I demonstrate on Thursday(10-20-10)

Ok so the task here in this tutorial is to continue to help you get familiar with Git, by actually making changes in the repo. This is assuming you have set up Git already(See here) and that you have an understanding of VIM or have changed the editor to Notepad++(See here).

Disclamer:
As I know someone is going to run into the problem, I thought I would warn you: be sure that your msysgit is INSIDE of your Gravity-Shift folder before trying these commands. This is important because it won't work otherwise.

Okay, the first thing you need to do before you make any changes(to avoid merge conflicts) is to fetch the latest data from MY Git repo. To do this you do this command:

git fetch upstream

This will get all the newest files and changes that the team has made in a whole. At this point, you have these changes locally, but you have not applied it to your own version yet(so if you opened one of the changed files, you would not see any changes). To receive these changes, you must merge the code with this command:

git merge upstream/master

Stop for a second
Why "upstream/master" ? Well, what we are saying is that we want to merge the code from upstream's master branch. If we start using lots of branches(ones for specific bugs, ones for stable releases, etc) this will be important to understand, but for now always do "upstream/master"

We now have the newest code on the computer, which we should now see "ContactList.txt" in the Gravity-Shift folder. Open this and add your contact information into it. Do not forget to save.

The next thing you need to do is commit your changes. Simply do this command:

git commit -a

Which will prompt you for a commit message. This is REQUIRED, and would be best if you do clear messages so that your code is easier to review. The correct format is always "Present Tense" sentences, using words like Add, Remove, and Change instead of Added(Adding), Removed(Removing), and Changed(Changing). Try to be persistent on this format.

After you committed, you need to push your changes.

Alright, woah...
What is the difference between commit and push, and why do I need to do both?

Commit finalizes any local changes on your own local distribution. This means what ever changes you make are official on your own hard drive and that's it. Push, on the other hand, copies those changes into your Github repo(the one online) so that it can be shared with the rest of the team. It is very important to understand that these are separate things, and that committing does not always mean that you need to push as well. You should always commit any changes on a regular basis, but you should only push when you are ready to share with the rest of the team.

So to push your local changes to your online repo, use this command:

git push origin master

Ahh, another weird command
Calm down, we are just saying that we want to push our changes to origin(which is our personal repo's) on its master branch.

VERY LAST STEP!!!!
Go to my repo(See here) and in the upper right corner you will see a button that says "Pull Request" . Press this button, and fill in the popup box with your changes(same format as commit messages) and send it off. I will then be able to take your code and merge it into the main repo so everyone can receive the changes.

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Next Post Previous Post
Powered by Blogger