OkayTeacher
EN English 한국어 日本語 中文 हिन्दी বাংলা اردو Español Português Français Deutsch Русский العربية Bahasa Indonesia Tiếng Việt ไทย Türkçe

How to enable notifications

Notifications are unavailable in this browser or on this address. Try a supported browser on the secure SONUB site.

If notifications are blocked, allow them in your browser settings.

  1. Open the site controls beside the address bar, or your browser’s site settings. Set Notifications for this site to Allow.
  2. In your device settings, allow notifications for your browser and check Do Not Disturb or Focus.
  3. Return to SONUB, reload the page, and use the bell to enable notifications.

On iPhone or iPad, add SONUB to your Home Screen, open it there, then allow notifications.

All steps
Step 5

Branching and merging

Split work off and bring it back later. Once you grasp how cheap a branch is, the way you use GIT changes.

What you'll learn

  • You can isolate work on its own
  • You can and resolve a yourself
  • You know branch naming conventions and the basic strategy

A branch is nothing more than a label pointing at a . It doesn't copy files, so creating and deleting one costs almost nothing. That's why in it's normal to open a branch per feature and per . git switch -c <name> creates one and moves you onto it in the same step; when the work is done you come back and merge.

A main road seen from above with a side road that splits off, passes a few milestones and joins the main road again further ahead.
A branch is a side road. Try things there, then merge back into the main road.

You merge with git merge. If the two branches touched different files, GIT combines them for you. If they changed the same lines of the same file differently, GIT refuses to guess: it marks a conflict and stops. A conflict is not an error — it's GIT saying "a human has to decide this one".

In a conflict the file gains <<<<<<<, =======, and >>>>>>> markers. Above is your current branch, below is what's coming in. Pick one side or combine both into correct , delete every marker line, then git add and commit to finish the merge. Prefixing branch names with the purpose — feature/, fix/, chore/ — lets the branch list alone tell you what's going on.

Understand it easily

A branch is a side road. You leave the road to try something, and if it works out you join the main road again (merge). If it does not, you simply leave the side road behind, and the main road was never touched.

Commands for this step

Don't just read them — type them into a real . Your hands have to remember, not your eyes.

git switch -c feature/login
Create a branch and switch to it in one step.
git switch main
Go back to the branch you want to merge into.
git merge feature/login
Merge the finished branch in. On conflict, GIT stops and asks you to decide.
git branch -d feature/login
Delete a merged branch. Cleaning up keeps the list readable.

Common mistake and how to fix it

Forgetting which branch you are on and committing to main. The first line of git status shows the branch. If it already happened and you have not , make a branch at that spot with git branch feature/x, then run git reset --hard HEAD~1 on main. The commit stays safe on the new branch.

You mark this yourself. Nothing is graded here.

Mark this step as understood?

This cannot be undone yet, so mark it only when you really understand.

Marked as understood

You mark this yourself. Nothing is graded here.