profile for joel goldstick at Stack Overflow, Q&A for professional and enthusiast programmers

Staging Files

Categories: git

Published on April 19, 2016

Last Modified on April 26, 2016

There are 3 'places' to think about when using git.

  1. Your current checked out files
  2. The staging area
  3. Committed files

Once you have set up a git repository it will track all of the files in the directory tree where it was created. When you edit a file, and are satisfied that you would like to update your repository you use the git add command

git add .
git add *.py
git add my_file.txt

If you aren't sure which files you have changed use git status

(git_course)jcg@jcg-netbook:~/code/venvs/git_course$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    deleted:    common_shell_commands
    modified:   directories
    modified:   toc
    deleted:    topics
    modified:   what_is_version_control

Untracked files:
  (use "git add <file>..." to include in what will be committed)


no changes added to commit (use "git add" and/or "git commit -a")