All your commits are on one branch called
main.
It is the version that your team uses, so a change that is not finished must not go there.So you work on your own branch, a separate line of commits that starts from
main:
Figure 1 - The Branch add-vlan Starts from main
To create a branch and move to it, you use
git switch -clike this:netops@automation:~/automation/netauto$ git switch -c add-vlan Switched to a new branch 'add-vlan' netops@automation:~/automation/netauto$ git branch * add-vlan mainYour commits now go on
add-vlanandmaindoes not change.git branchlists your branches, with a star on your current branch.You may also see
git checkout -b, the older way to writegit switch -c.In the lab, you need to:
Create the branch
add-guest.In the Editor tab, add the line
40: GUESTat the end ofvlans.yaml.Stage the change and commit it.
Answer the question below
Enter the flag you obtained.
When the work on your branch is ready, you merge it into
main:
Figure 2 - main Gets the Commit of the Branch
You go back to
mainwithgit switch main, then you merge the branch like this:netops@automation:~/automation/netauto$ git switch main Switched to branch 'main' Your branch is up to date with 'origin/main'. netops@automation:~/automation/netauto$ git merge add-vlan Updating 9404f3a..639bb34 Fast-forward vlans.yaml | 1 + 1 file changed, 1 insertion(+)Fast-forwardmeans that Git movedmainforward to the commit of the branch.In the lab, your work on the branch
add-wifiis ready.
Merge it intomainto get the flag.Answer the question below
Enter the flag you obtained.
Imagine you rename VLAN 10 to OFFICE on
main, and a teammate renames it to STAFF on the branchrename.
The two branches changed the same line. This is a conflict:
Figure 3 - Two Branches Changed the Same Line
Git cannot choose between the two names, so it stops the merge. Nothing is broken:
netops@automation:~/automation/netauto$ git merge rename Auto-merging vlans.yaml CONFLICT (content): Merge conflict in vlans.yaml Automatic merge failed; fix conflicts and then commit the result.In the file, Git wrote the two versions of the line:

Figure 4 - The Two Versions of a Line in Conflict
To finish the merge, you edit the file. You keep the line you want, and you delete the other line and the three lines that Git added.
Then you stage the file and you commit.In the lab,
mainand the branchrenameboth changed the name of VLAN 10, and the team chose the name fromrename. You need to:Merge
renameintomain.In the Editor tab, keep the name that comes from
renameinvlans.yaml.Stage the file and commit.
Answer the question below
Enter the flag you obtained.