Java Reference
In-Depth Information
Then we'll add it and commit just that one file by specifying the file name
instead of the -a we usually use:
$ git add .gitignore
$ git commit .gitignore -m 'ignoring bin and dist'
[master cc0e424] ignoring bin and dist
1 file changed, 2 insertions(+)
create mode 100644 .gitignore
Let's see what gitstatus tells us now:
$ git status
# On branch master
nothing to commit, working directory clean
Great! We got the reassuring message “nothing to commit, working directory
clean.” That message is what you want to see when you're finished coding for
the time being.
Now add some text to the bottom of README.txt , save the file, and try git status
again:
$ git status
# On branch master
# Changes not staged for commit:
#
(use "git add <file>..." to update what will be committed)
#
(use "git checkout -- <file>..." to discard changes in working directory)
#
#
modified:
README.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
Ah, that's clever: Git recognized that you'd made some changes to the README.txt
file and that those changes haven't been saved yet. A commit will fix that,
and once again you can get the relaxing “nothing to commit, working directory
clean” message:
$ git status
# On branch master
nothing to commit, working directory clean
So there's one important rule to remember:
Don't leave the scene until the working directory is clean.
An Easy Undo
Say you're going along and accidentally remove a file from your plugin direc-
tory. Or maybe you made a series of edits that turns out to be a really bad
idea, and you want to go back. Oops. Have no fear: we've all done it.
 
 
Search WWH ::




Custom Search