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







