Staging and committing files

Introduction to Git

George Boorman

Curriculum Manager

The Git workflow

  • Edit and save files on our computer

 

  • Add the file(s) to the Git staging area
    • Tracks what has been modified

 

  • Commit the files
    • Git takes a snapshot of the files at the point in time
    • Allows us to compare and revert files
Introduction to Git

Staging versus committing

Staging area

 

Letter going into an envelope

Making a commit

 

Mail box

Introduction to Git

Adding to the staging area

  • Adding a single file
git add README.md

 

  • Adding all modified files
git add .
  • . = all files in the current directory and sub-directories
Introduction to Git

Making a commit

git commit -m "Adding a README."
[main cb33c18] Adding a README.
 1 file changed, 1 insertion(+)
 create mode 100644 README.md
  • -m Allows a log message without opening a text editor
  • Log message is useful for reference
  • Best practice = short and concise
Introduction to Git

Let's practice!

Introduction to Git

Preparing Video For Download...