GitHub for Beginners #10: Branching & Merging in Visual Studio 2026

Опубликовано: 13 Июнь 2026
на канале: Benjamin Day
122
1

In the last video we talked about what a branch is and why you'd want one. Now let's actually do it. We'll take the Hello World app, fix a real little problem in it — that comically gigantic "lucky number" — and make the change safely on a branch in Visual Studio 2026. You'll see the whole lifecycle: create a branch, commit and push your work, merge it back into main, and clean up after yourself.

What you'll learn:
How to create a branch from the Git Changes window in Visual Studio 2026
The feature/ branch naming convention — and why it helps when a team shares a repo
Local vs. remote branches: why your new branch isn't on GitHub until you publish it
How to publish (push) a branch up to GitHub
Reading the "ahead / behind" indicators to see how in-sync a branch is
Comparing a branch against main — both on GitHub and in Visual Studio's commit view
How to merge your branch into main locally, then push the merge
Cleaning up by deleting both the local and the remote branch

Key insights:
Creating a branch is fast and cheap — give it a name, click create, done
A branch is local until you publish it — no publish means no backup
"origin" is just the default name for your remote repository on GitHub
You can commit half-finished, even non-compiling code on a branch — it's isolated, so nobody else is affected
Switch to main before merging and your change isn't there — that's the isolation, made visible
A merge happens locally first; you still have to push it to land it on GitHub
Deleting a branch has two parts: the local copy and the remote copy
Main only changes when you decide to merge

What we'll do:
Open the Hello World solution and spot the problem — the lucky number is a giant, unusable value
Create a feature/lucky-number-max-range branch from the Git Changes window
See that the branch doesn't exist on GitHub yet, then publish it
Add a max-range parameter to the lucky number method, committing as we go — build errors and all
Update the interface and the call site until it builds and runs cleanly
Compare the branch against main on GitHub and in Visual Studio
Merge the feature branch into main, then push the merge
Delete the branch locally and on the remote, and confirm the change landed on main

Previous Video: What is Branching and Why Should You Care?
Next Video: Branching & Merging in VS Code
► Full Playlist:    • GitHub for Beginners  

Ready to branch with a whole team? My "Branches That Don't Suck" series picks up right where this leaves off:    • Branches That Don't Suck  

Made your first branch? Hit that like button!
Subscribe and enable notifications — next up, we do the exact same thing in VS Code.
Do you create branches from Visual Studio, the command line, or somewhere else? Tell me in the comments!

#GitHub #Git #Branching #VisualStudio #VS2026 #Programming #Tutorial #GitHubForBeginners #dotnet #GitTutorial

0:00 Branching in Visual Studio 2026
1:10 What Branch Are We On?
1:45 Create a Branch
3:05 Local vs. Remote Branches → Push the Branch
4:30 Make Some Changes in the Branch
6:09 Compare the Branches on GitHub
6:49 Branch Status in Visual Studio 2026
7:40 Switch Branches from Feature to Main
8:25 Merge the Changes to Main
9:48 Push the Merge to GitHub
10:28 Cleanup / Delete Branches
11:53 Thanks for Watching