Change, Commit, Push (a Text file)

The goals for this exercise are to

  1. Change a file, save the file into git, and then upload those changes back to your copy of the project on GitHub

  2. For this exercise we'll use a text file because we don't compile or run text files.  In other words, we can't mess up our program nor get any compile-time errors since the file isn't C# source code.

What you need to do to prepare for this exercise:


For this exercise make sure that you have Visual Studio open.  Within Visual Studio make sure that you have the 'Solution Explorer' open.  If it's not open you can show it using the View -> Solution Explorer menu item.

Within the Solution Explorer double-click on the 'Poetry.txt' file.

Add a new line of poetry to the end of the file.  Anything that's 'safe for work' is fine.

Save the file using the File -> Save menu item, like you normally do.

Note that right now, after you've saved the file but before you've committed the changes to git, the change you just made is saved in the Poetry.txt file on your hard drive BUT it has not yet been saved into git (nor into GitHub).

You can commit your change(s) by opening up the Team Explorer window, using the View -> Team Explorer menu item.

Make sure that you click on the 'House' icon to bring you to the Home panel here in Team Explorer:

Once you've gotten to the Home panel click on the button labeled "Changes", so that it shows you what's changed since your last commit (and gives you the option of committing your current changes):

As you can see in the above picture, the file 'Poetry.txt' list listed in the Team Explorer panel, under the 'Changes' section.  If you double click on that file Visua Studio will show you the difference between the current version of the file and the last version that was saved into git, side by side.  It'll even highlight the lines that have changed.

After trying that out you should click on the box labeled "Enter a commit message..." and fill in a quick, one-line summary of the change you just made.  Something like "Added a line of poetry to the end of the file" might be good.

Once you've entered a commit message you can click on the 'commit all' button to save your changes into git.  It's worth noting that you cannot commit until you type in a message - Visual Studio will literally 'gray out' the button so that you can't click on it.  Make sure that you include a commit message!!

However, you've only saved the changes ("committed the changes") into your git repo on your local computer.  You have NOT yet uploaded your changes to your account on GitHub.  In order to upload your changes to GitHub we're going to have to push the changes up to GitHub.

Click on the 'Home' icon to bring yourself back to the home panel, then click on the 'Sync' button.

Within the 'Outgoing Commits' section click on the button labeled 'Push":

After a short(-ish) delay the changes will be pushed to GitHub.

You can confirm that the push worked by opening up that same page in your browser and the clicking on the phrase '2 Commits':

On the page that appears you should see your latest commit (changes) listed.  You can click on it to see the changes in detail.

 

What you need to do for this exercise
  1. Add a line to the end of the Poetry.txt file and save the file.
  2. Commit your changes to your local git repo
  3. Push your changes to your account in GitHub