Chapter 1. Git & GitHub Key Concepts

How To Save Versions in Git?

How To Save Versions in Git?
Tag:

Git allows us to track all changes in our working files, however, it doesn’t record every single change. Git tracks only committed files (a snapshot of a set of project files). This is like when we save a file on our computer as one version and save it again as another version with different file names.

Committed files are stored in a Local or Remote Repository. Through the Remote Repository, you can share your work and collaborate with others. Here we’ll explain how to manage working history under a Local Repository.

Three-Stage Architecture
  • Working Tree (Working Directory) is used to edit your working files. The files and directories that you usually see in the project directory are the Working Tree.

    How-To-Save-Versions-in-Git

  • Staging Area (INDEX) is a buffer area used to prepare your working files for commit. The command to bring the working files into the Staging Area is git add. You can double-check if the files you added to the Staging Area are ready for commit. If the files are ready, you can commit and save them under your Local Repository. The command to commit files is git commit.

    How-To-Save-Versions-in-Git

  • Local Repository is a place where committed files are stored with version histories. By running the git commit command, you can commit your files in the Staging Area to save a version under your Local Repository. At this stage, your files are still on your computer and not accessible to others. To share the files, you need to bring the files to a Remote Repository, which is explained on the next page.

    How-To-Save-Versions-in-Git

When committing files, you need to write a message describing what the commit is about: for example, "added payment function" or "fixed errors".

When running the git commit command, a text editor launches automatically for writing comments. Vim text editor is the default setting typically. For the purpose of this course, Visual Studio Code will be used.

More details will be provided in Chapter 4. Edit & Commit .

Git allows us to track all changes in our working files, however, it doesn’t record every single change. Git tracks only committed files (a snapshot of a set of project files). This is like when we save a file on our computer as one version and save it again as another version with different file names.

Committed files are stored in a Local or Remote Repository. Through the Remote Repository, you can share your work and collaborate with others. Here we’ll explain how to manage working history under a Local Repository.

Three-Stage Architecture
  • Working Tree (Working Directory) is used to edit your working files. The files and directories that you usually see in the project directory are the Working Tree.

    How-To-Save-Versions-in-Git

  • Staging Area (INDEX) is a buffer area used to prepare your working files for commit. The command to bring the working files into the Staging Area is git add. You can double-check if the files you added to the Staging Area are ready for commit. If the files are ready, you can commit and save them under your Local Repository. The command to commit files is git commit.

    How-To-Save-Versions-in-Git

  • Local Repository is a place where committed files are stored with version histories. By running the git commit command, you can commit your files in the Staging Area to save a version under your Local Repository. At this stage, your files are still on your computer and not accessible to others. To share the files, you need to bring the files to a Remote Repository, which is explained on the next page.

    How-To-Save-Versions-in-Git

When committing files, you need to write a message describing what the commit is about: for example, "added payment function" or "fixed errors".

When running the git commit command, a text editor launches automatically for writing comments. Vim text editor is the default setting typically. For the purpose of this course, Visual Studio Code will be used.

More details will be provided in Chapter 4. Edit & Commit .

Tag: