Test MDX File V9
Virtual Lab: Git Flow
Section titled “Virtual Lab: Git Flow”This virtual lab lets you run the four most common Git commands and watch what they actually do. There is one file, hello.txt, and you move it through four stages.
Working Directory — where you edit files on your computer.
Staging Area — a holding area for changes you’ve marked as ready to commit.
Local Repo — your personal commit history (HEAD points to the newest commit).
Remote Repo — the shared copy on a server, e.g. GitHub.
What the commands do
- Edit
hello.txtin the text area. The file card turns modified. git add— copies the working-directory version of the file into the staging area.git commit— type a message, then click. The staged version is recorded as a new commit on the local repo.git push— uploads local commits to the remote.git pull— downloads remote commits to the local repo.
Try this sequence:
- Edit
hello.txt. git add→git commit(with a message) →git push.- Click 👥 Teammate pushes to simulate someone else committing to the remote.
git pullto bring their changes down to your local repo.- Now edit the file again, commit, and try
git pushbefore pulling — you’ll see the real “Push rejected — pull first” error. Rungit pull, then push again.
Notes:
- Buttons grey out when there’s nothing to do (e.g.,
git addwhen nothing has changed). Hover for the reason. - The What happened panel narrates every command in plain English — read it after each click.
- The dots near the bottom show whether your local or remote is ahead.
- Click ↻ Reset to start over.
Git Workflow Lab
Click commands to move hello.txt through the four stages and watch how add, commit, push and pull actually behave.
Virtual Lab: Git Branch
Section titled “Virtual Lab: Git Branch”Branching, Merging and Conflicts
Section titled “Branching, Merging and Conflicts”Now that you’ve seen how add, commit, push and pull move a single line of work between the working directory, staging area, local repo and remote, it’s time for the next idea: doing more than one thing at once. Branches let you split a project’s history so you can develop a new feature, try an experiment, or apply a hotfix without disturbing the work everyone else is doing on main. Merging is how those parallel histories come back together. This is sometimes clean, sometimes not.
The lab below renders the local repository as a left-to-right commit graph, with each branch on its own horizontal “lane”. The remote panel on the right is your GitLab origin: branches only appear there once you push them. As you create branches, switch between them, commit, and merge, watch how the graph changes shape — that shape is what git log --graph is showing you on the command line.
Tasks to try
Section titled “Tasks to try”Work through these in order. After each one, glance at the What happened panel at the bottom as it explains what each command did, in plain English.
- Make a branch and switch to it. From the fresh starting state (press “reset”), type a name like
feature/logininto the branch field and clickgit branch. Notice thatHEADdoesn’t move as you’ve created a label, but you’re still onmain. Now usegit switchto move onto the new branch. - Commit on a branch. With
HEADon your feature branch, make two commits. Watch how only the feature lane grows;mainsits still on its own commit. Use “git push origin” to publish the branch to GitLab. Switch back tomainand then merge the branch into main. Notice that theHEADis now on the feature branch. If you push now you can publish this update to GItLab.
The mental model
Branches are not folders or copies of the code. A branch is a movable label that points at a single commit. git branch creates a label; git switch moves HEAD to a different label; committing advances whichever label HEAD is currently riding. The graph is the truth and the labels are just convenient names for spots on it.
Git Branching Lab
Create branches, switch between them, and watch git merge handle fast-forwards, three-way merges, and conflicts. Push branches to GitLab so they're ready for a merge request.
Now try some presets:
- Fast-forward merge. Load the Feature ready to fast-forward preset. You’re on
main(i.e., HEAD), andfeatureis two commits ahead. Rungit merge feature. Themainpointer slides forward to meetfeature— no merge commit is created, becausemainhad no commits of its own to combine. - Three-way merge. Load the Diverged branches preset. Now both branches have new commits, so a fast-forward isn’t possible. Run
git merge featurefrommainand look closely at the resulting commit: it has two parent edges feeding into it. That’s a merge commit, and it’s how Git records “these two histories came back together here”. - Resolve a conflict. Load the Merge conflict ahead preset. Both branches edited the same line of
READMEdifferently. When you rungit merge feature, the merge pauses and a red panel appears with the file showing<<<<<<<,=======and>>>>>>>markers — exactly what you’d see in a real editor. Try the Keep ours, Keep theirs and Keep both shortcut buttons to see what each does, then commit to complete the merge. - Publish a branch to GitLab. With a feature branch checked out, click
git push origin. The branch appears in the right-handoriginpanel with the prefixorigin/feature/login. In a real workflow this is the moment you’d open a merge request on GitLab. - Clean up. Once a feature branch has been merged into
main, you can safely delete the local label withgit branch -d. The commits don’t disappear — they’re still reachable frommain— but the branch pointer is gone. Try deleting an unmerged branch and read the error: Git protects you from losing work.
Account Stack Lab
Section titled “Account Stack Lab”Account Lab
C++ Class Object Lab
Drag a class onto the stack and watch the object's bytes lay out — fields, padding, inherited base and all.
Account Heap Lab
Section titled “Account Heap Lab”Heap Lab
C++ Heap Allocation Lab
new on the heap, virtual dispatch through the vtable, and the three classic heap bugs.
© 2026 Derek Molloy, Dublin City University. All rights reserved.