By the end of this laboratory session, students will be able to:
- Clone a shared GitHub repository.
- Create and switch to a branch from
mainbefore making changes. - Add and modify files.
- Stage, commit, and push changes to GitHub.
- Merge changes back into
main.
- Git must be installed on the workstation (
git --versionto verify). - Students must have an active GitHub account.
- A text editor or IDE (Visual Studio Code recommended).
Each student must configure their Git identity for this repository only (not global):
git config user.name "Your Name"
git config user.email "[email protected]"Verify your configuration:
git config --list --localIf you want Git to remember your credentials securely, enable the credential manager:
git config credential.helper manager- On macOS, you may use the macOS Keychain:
git config credential.helper osxkeychain
- On Windows, you may use:
git config credential.helper manager-core
This ensures Git will prompt you for credentials only once per repository and store them securely.
Each student will clone the class repository:
cd path/to/your/workspace
git clone https://github.com/hernzia/DCIT26_LabAct-1.git
cd DCIT 26_LabAct-1Each student must create a branch named using this format:
(Surname- Course/Yr/Sec)/<your-student-number>
Example:
git checkout -b RAMONES-CS_3-3/201811394This ensures that every student works on their own branch without affecting
main.
Create a file named notes.txt:
echo "This is my notes file." > notes.txtStage and commit:
git add notes.txt
git commit -m "Add notes.txt file with initial content"Push the branch to GitHub:
git push origin feature/201811394Edit README.md using an editor or terminal:
echo "\n## Additional Notes\nThis is an update." >> README.mdStage, commit, and push:
git add README.md
git commit -m "Update README with additional notes"
git push origin RAMONES-CS_3-3/201811394Students should verify changes on GitHub in their own branch.
After everyone has pushed their branch, the instructor may demonstrate merging one branch into main.
git checkout main
git merge RAMONES-CS_3-3/201811394
git push origin mainStudents must:
- Refresh the repository page on GitHub.
- Confirm that their branch (e.g.,
RAMONES-CS_3-3/201811394) exists. - Check that their commits and files appear under their branch.
| Action | Command |
|---|---|
| Configure identity | git config user.name / git config user.email |
| Credential manager | git config credential.helper manager (or osxkeychain/manager-core) |
| Clone repository | git clone https://github.com/2026-DCIT26/LabActivity1.git |
| Create branch | git checkout -b feature/201811394 |
| Switch branch | git checkout <branch> |
| Stage file(s) | git add <filename> |
| Commit changes | git commit -m "message" |
| Push to branch | git push origin feature/201811394 |
| Merge branch | git merge feature/201811394 |
| Check status | git status |
| View changes | git diff |
Each student must:
- Submit a screenshot of their terminal showing
git logfrom their personal branch. - Provide a link to their branch in the repository.
- Ensure that
notes.txtand README updates are visible in their branch on GitHub. CARPIO-CS_3-4/202302454 \n## Additional Notes\nThis is an update BARRO_CS_3-4/202302759 "\n## Additional Notes\nThis is an update."
CLEOFAS-CS_3-4/202301458 \n## Additional Notes\nThis is an update. "\n## Additional Notes\nThis is an update." main main main