Make commit locally#

In this exercise you’ll work on making changes to a git repository locally and pushing those to GitHub.

Task 1 Edit files#

Now let’s make an edit locally. The benefit from working locally is that you can use other software and that you can edit multiple files together in a single commit. Our first edit will be some text here:

Open the directory of your local repository (from VS code itself or click ‘Open in Visual Studio Code in GitHub Desktop) to edit this file. Make sure to open the full directory, not just this single file!

Task 2 Create file#

For your second edit you have to create a file my_first_file.md with some random content.

Use VS code to create a file and type some text. When doing so, click the preview button in the top right corner of the editor (or do Ctrl + K V or Ctrl + Shift + V) to see the rendered version of your markdown file.

Task 3 Commit your changes#

Now let’s commit your changes of this file 10_commit_local.md and my_first_file.md. In GitHub Desktop you should see both files and the changes made. Make sure you select both of these changes and commit those changes by clicking the blue ‘Commit 2 files to main’.

Task 4 Push your changes#

Now that we have recorded our commits with git, there is one last thing to do: update the remote repository on GitHub. We can do this by pushing the commit, using the blue ‘Push origin’ in the middle of the screen or ‘Push origin’ in the bar on the top.

Task 5 Check your online repository#

Open your repository on GitHub to check whether your changes made it there!

Task 6 Check commit history#

Your commit history now should look like this:

Git history

You can get a visualization of this commit history in VS code under the ‘source control’ tab in the ‘Graph’ panel.

Git history

By Tom van Woudenberg and Robert Lanzafame, Delft University of Technology. CC BY 4.0, more info on the Credits page of Workbook. This page uses content from Learn Programming for Engineers by Delft University of Technology, licensed with CC BY 4.0 License.