1. Technology
Send to a Friend via Email
You can opt-out at any time. Please refer to our privacy policy for contact information.

Use 'status' When You're Lost


It's easy to get lost when using Git. You essentially have two sets of files, your working set and the set in the repository. Keeping track of which files have changed is important.

To get a list of files that you have changed since you last committed, you can use the git status command. This will print a list of files that have changed or you have added. Once you commit the changes and the working files are in sync with the files in the repository, the git status command will show an empty list.

The following example assumes you have a git repository with the file index.html already added and committed, and that you've now edited the file.

 $ git status
 # On branch master
 # Changed but not updated:
 # (use "git add ..." to update what will be committed)
 # modified: index.html
 no changes added to commit (use "git add" and/or "git commit -a")
 $ git commit -am 'Made some changes'
 Created commit 8a6f395: Made some changes
 1 files changed, 1 insertions(+), 1 deletions(-)
 $ git status
 # On branch master
 nothing to commit (working directory clean)
  1. About.com
  2. Technology
  3. Ruby
  4. Tutorials
  5. Using the Git Version Control Tool with Ruby
  6. Where Was I Again? Use 'status' When You're Lost

©2014 About.com. All rights reserved.