githubteacher / github-for-developers-sept-2015

practice repo for the Sept 29-30 GitHub for Developers class
12 stars 36 forks source link

Local commit issues #657

Closed gstanek closed 9 years ago

gstanek commented 9 years ago

When I type git commit, I am prompted to enter a commit messages as expected. I'll enter something like the following and save the file. Then, when I type git status afterwards, the file has not been committed. What am I doing wrong?

Short commit message for practice

Detailed commit message for practice

Please enter the commit message for your changes. Lines starting

with '#' will be ignored, and an empty message aborts the commit.

On branch gpstanek-local-branch

Changes to be committed:

new file: gpstanek-new-file.txt

Command line output (see error message within): gstanek@CRYL0770E675318 MINGW64 /c/Dev/workspace-gitdemo/github-for-developers-sept-2015 (gpstanek-local-branch) $ git commit Aborting commit due to empty commit message.

saranicole commented 9 years ago

It's not saving the commit message.

You can add the message right in the git commit command:

git commit -m "My awesome comment"

Then you can do a push to your branch:

git push -u origin mybranch

gstanek commented 9 years ago

@saranicole What you've suggested worked (with the shorthand -m option). Thanks for that.

In the case of using the text editor, it looks like Git Bash didn't pick up the commit file possibly due to the fact that I had multiple Atom editor windows open. When all windows were closed and I've saved and closed the Atom editor, The commit message did register. Good to know.

I'm running Windows, Git Bash, and using Atom as my text editor.

saranicole commented 9 years ago

Cool, thank you for confirming. Will close out issue then.