Imagine a teammate changes your script and it stops working.
To fix it, you need to know what changed, so you keep a copy of the file for each version.Git is a version control tool. It saves each version of your files in a history:

Figure 1 - One Copy for Each Version, or One File and Its History
Each point of this history is a commit: a version of your files, with who saved it and when.
Your team keeps its files and their history in a repository on a Git server.
To work on these files, you copy the repository to your server withgit clone:
Figure 2 - git clone Copies the Repository of the Team
In the lab, you need to:
Get the repository with
git clone http://10.0.0.10/netauto.git.Go into it with
cd netauto.Read its history with
git log --oneline.
Answer the question below
How many commits does the history have?
You ask an AI assistant to fix the name of VLAN 20 in
vlans.yaml.
It fixes the name, but it also changesdeploy.py, and you did not ask for that.With Git, you choose the changes that you save. You stage them with
git add, which puts them in the staging area:
Figure 3 - Only the Change You Want Goes in the Staging Area
To see the files that changed and what is in the staging area, you use
git statuslike this:netops@automation:~/automation/netauto$ git add vlans.yaml netops@automation:~/automation/netauto$ git status ... Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: vlans.yaml Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: deploy.pyChanges to be committedis what the staging area holds.In the lab, the AI assistant already changed the two files.
Stage only the fix of VLAN 20 and rungit statusto get the flag.Answer the question below
Enter the flag you obtained.
To save what is in the staging area, you use
git commit.
You give it a message that says what you changed, after the option-m:
Figure 4 - A New Commit in the History
In the terminal, Git answers with what the commit changed:
netops@automation:~/automation/netauto$ git commit -m "Fix VLAN 20" [main d1bb917] Fix VLAN 20 1 file changed, 1 insertion(+), 1 deletion(-)A change that is not staged is not in the commit.
To drop a change you do not want, you usegit restorewith the name of the file.In the lab, you need to:
Stage the change in
vlans.yaml.Commit it with the message
Fix VLAN 20.Drop the change in
deploy.py.
Answer the question below
Enter the flag you obtained.
Nobody uses
old_inventory.yamlanymore, but nobody deletes it, in case it is needed one day.
With Git, the old commits still hold the file, so you can remove it:
Figure 5 - The Old Commits Still Hold the File
To remove a file, you use
git rm, then you commit:netops@automation:~/automation/netauto$ git rm old_inventory.yaml rm 'old_inventory.yaml' netops@automation:~/automation/netauto$ git commit -m "Remove the old inventory" [main 7ad1628] Remove the old inventory 1 file changed, 2 deletions(-) delete mode 100644 old_inventory.yamlIn the lab, the repository has two files that nobody uses anymore.
Remove them in one commit to get the flag.Answer the question below
Enter the flag you obtained.