liveBook · Manning

Git

As explained in Road to Kubernetes

Git is a distributed version control system for tracking changes to files and coordinating software development.

Git is a version control tool: it tracks changes to code so you can inspect what changed, return to an earlier version, and share code with other machines. Think of undo and redo, but for saved versions of a project. Git also helps make application code available for deployment automation. section 2.3 section 1.2

Start with a project directory on your computer:

  • Check that Git is installed with `git --version`. A version number means the command is available. section 2.3
  • Run `git init` inside the project directory to create a local repository, often shortened to “repo.” Initialize the Python and Node.js application directories separately if they are separate projects. section 2.3.1
  • Run `git status` to see whether the directory is a repository and which files are untracked. Git does not save changes just because a file exists; you must tell it what to track. section 2.3.1
Listing 2.23 Using git init to initialize a Git repository
cd ~/Dev/roadtok8s/py/
git init

The Python application commands show the smallest first step: enter its directory, then initialize a repository there. The Node.js application can be initialized the same way in its own directory. section 2.3.1

A new repository exists only on your computer until you configure a remote repository. Pushing uploads code to that remote; pulling downloads code where it will run. Git can also ignore selected file types and help revert changes. Branches manage different versions of code, but branching is not needed for this initial workflow. section 2.3 section 2.3.1

From a local app to a server

For a manual deployment, install Git on the cloud VM, upload the application code from your computer, and use Git hooks to trigger scripts that update the server. A GitHub repository and GitHub Actions provide a path toward automated integration workflows; later, activity in Git can trigger container builds. Git supplies the tracked, shareable code that each approach starts from. section 3.0 section 1.2 section 3.3.1

How Road to Kubernetes covers it

How deep it goes
Works through installation checks, repository initialization, and status; identifies branches but leaves branching beyond scope.
Examples
Uses separate Python and Node.js repositories, `git status` output, and Git installation on a cloud VM.
What it assumes
Assumes basic command-line experience and existing web applications for deployment, while introducing repositories and version control from the beginning.
What you can do after
Operate/configure it to initialize local application repositories, inspect file status, and prepare code for sharing and deployment.
How it connects
Connects remote repositories to GitHub Actions, CI/CD, Git hooks, and container builds.

Also explained in

Compare how 8 books explain git →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.