There are two possible courses of action, depending on your needs:
$ git reset
$ git reset --hard
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:
"i"
key.esc
key.:wq
" and press enter
.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
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.
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.
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.