Git for Beginners: Branches, Merging, and Merge Conflicts Explained | Lesson 4

▶ Git, GitHub, and GitHub Actions for Beginners:
https://www.youtube.com/watch?v=iUWa0cGHZms&list=PLUHnYREC5ofgYs0KwYpSNQpdk4S10R4J-

In this lesson, you will learn how Git branches work and why they are useful even in small projects. We will create a separate branch, switch between branches, make changes, and merge the branch back into main. You will also see what a merge conflict looks like and how to resolve it manually using nano. By the end of this lesson, you will understand the basic Git workflow: create a feature branch, commit changes, merge into main, and clean up the branch.

00: 00 Introduction
00: 58 What a branch is in Git
01: 59 Why branches are useful even in a small project
02: 55 Continue working in the existing repository
03: 41 git branch — how to view branches
04: 25 git switch — how to switch between branches
05: 47 Creating a separate branch for a task
12: 02 Merge — merging a branch into main
13: 17 What a conflict is
17: 17 A simple conflict in practice
21: 17 Resolving a conflict with nano
22: 48 Workflow: feature branch → merge into main
24: 06 Summary and what will be in the next lesson

Commands used in this lesson:
git branch — shows the list of branches in the repository.
git branch -M main — renames the current branch to main.
git switch -c branch-name — creates a new branch and switches to it immediately.
git switch main — switches back to the main branch.
git merge branch-name — merges changes from another branch into the current branch.
git branch -d branch-name — deletes a local branch after it has been merged.
git log –oneline –graph –all –decorate — shows the commit history as a simple graph with branch names.

#Git #GitHub #DevOps