Skip to the content.

Class 3 Reading Notes

Return to Home

Version control

Version Control is a system that allows you to revisit various versions of a file or set of files by recording changes. Through version control, one can revert a file or project to a previous version, track modifications and modifying individuals, and compare changes.

Types

So, What is Git?

Workflow

Local repository Structure

The local Git repository has three components:

Workflow

Saving Changes

All files in a checked out (or working) copy of a project file are either in a tracked or untracked state.

Tracked -Tracked files can be modified, unmodified, or staged; they were part of the most recent file snapshot. Untracked- Untracked files were not in the last snapshot and do not currently reside in the staging area.

Check File Status

To determine the state of files, utilize the git status command: git status

Tracking and Staging a New File

Single File- Track one file only by using the following format: git add filename

All Files- Track all files in a repository by using the following command:$ git add *

Committing a File

After staging one or multiple files, you should commit the changes and record what you did within the commit message:

$ git commit -m “made change x,y,z”

Committing All Changes

$ git commit -a

Pushing Changes

Next, you would push changes to a remote repository.

Example:

$ git push origin master

This command pushes changes from the local “master” branch to the remote repository named “origin”. For cloned repositories, Git will automatically give the name “origin” to the server from which you cloned and the name “master” to your local repository. However, these names can be changed by the user