Home
Setup
Committing
Eclipse and Git
FAQ

Frequently Asked Questions

"I have made a grave error. How do I reset everything??"

There are two possible courses of action, depending on your needs:

"When I commit, Git drops me to a scary editor with no on-screen help! How do I get out?"

It's likely that your default text editor is set to some sort of vi implementation. To do your thing and get out, follow these steps:

  1. Press the "i" key.
  2. Type your commit message.
  3. Press the esc key.
  4. Type ":wq" and press enter.
  5. Tada!

If you want Git to default to a more user-friendly text editor, configure it to use your favorite.

For example:

  $ git config --global core.editor nano

Or, if you want something more graphical:

  $ git config --global core.editor gedit

"I tried to commit, but I got Aborting commit due to empty commit message. Huh?"

When Git expected you to provide some sort of commit message, ie: "Init commit", you probably made one of the following errors:

The index and working directory have been left intact, but you will have to repeat the commit operation. This time, be sure to enter a commit message and save before quiting.

"When I commit, Git complains nothing to commit (working directory clean). What did I do wrong?"

This error indicates that none of the tracked files have been modified. Make sure you've saved all of the files you've changed and called git add on all of the files you want to include in the commit.

"I have a bunch of files in my directory that I don't want Git to track. How do I make the annoying reminders stop?"

Luckily for you, Git has a built-in feature for this purpose! If you have some files in your Git repository that you want to keep around but do not want Git to track (or remind you about!), you should create a .gitignore file.

A .gitignore file specifies files that are intentionally untracked and that Git should ignore. (Note: this does not apply to files that you already told Git to track.) A .gitignore file should contain a set of patterns that indicate the file paths that should not be tracked.

For example, if you are working with Java, it is silly to track the .class files that are created when you compile your code. To make Git ignore these files, we would first create the .gitignore file:

  $ touch .gitignore

Within the new file, insert the following text, then save and quit:

  *.class

This tells Git that, whenever a file path ends with ".class", it should be ignored.

To get more information and for additional examples, browse the gitignore Manual Page.