Lab 8 - Functions

Getting the Latest Changes

Before starting this lab, ensure you have the latest changes. If you have no local changes, you can simply run git pull and you are ready to go:

student@hsi:~$ cd hardware-software-interface
student@hsi:~/hardware-software-interface$ git status         # Check if you have unstaged changes
On branch main
nothing to commit, working tree clean

# "working tree clean" means that you have no changes
student@hsi:~/hardware-software-interface$ git checkout main  # Change branch to main
student@hsi:~/hardware-software-interface$ git pull --rebase

If the git status output differs, follow the instructions to save your progress.

Save Progress and Prepare Next Lab

  1. Check if you have unstaged changes that might be lost:

     student@hsi:~$ cd hardware-software-interface
     student@hsi:~/hardware-software-interface$ git status
     On branch <not-important>
     Changes not staged for commit:
     (use "git add <file>..." to update what will be committed)
     (use "git restore <file>..." to discard changes in working directory)
             modified:   main.c
    

    If git status states “work tree clean”, you should follow the instructions to pull latest changes instead.

  2. Create a commit to store your changes:

     student@hsi:~/hardware-software-interface$ git add .
     student@hsi:~/hardware-software-interface$ git commit -m "Store progress for lab-07"
     student@hsi:~/hardware-software-interface$ git status    # double check that everything was committed
     On branch <not-important>
     nothing to commit, working tree clean
    
  3. Create a new branch for lab-08:

     student@hsi:~/hardware-software-interface$ git checkout -b lab-08 main  # Replace lab-08 with lab number
     student@hsi:~/hardware-software-interface$ git pull origin main        # Get latest changes from origin/main
    

Table of contents