Discussion:
Beginner stuck in a commit
Jeffery Brewer
2012-08-07 02:57:13 UTC
Permalink
I've slowly been trying to get git to work and just running into loads of
problems.

Using the windows bash I just tried to do a commit this evening and forgot
to add a message (e.g. -m "my work for today") and sent the bash into some
sort of odd editing mode that I can't seem to get out of. I finally just
closed the bash and opened a new bash and tried to commit and got all kinds
of error messages with a prompt to type (R) to recover. Typed R to recover
and it took me right back into the strange editing mode that I can't seem
to get out of now. I've backed up all the files in the directory (sensing
an impending catastrophe) but not sure what else to do at this point to get
git running again.

Any help would be appreciated.

More detail...

If I open a new bash in the directory and run "git commit" I'm getting this
error message:

E325: ATTENTION
Found a swap file by the name ".git\.COMMIT_EDITMSG.swp"
dated: Mon Aug 06 19:45:14 2012
file name:
C:/Users/me/Documents/NetBeansProjects/foldername/.git/COMMIT_EDITMSG
modified: YES
user name: me host name: my computer
process ID: 10368
While opening file ".git\COMMIT_EDITMSG"
dated: Mon Aug 06 19:55:29 2012
NEWER than swap file!
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r .git\COMMIT_EDITMSG"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".git\.COMMIT_EDITMSG.swp"
to avoid this message.
Swap file ".git\.COMMIT_EDITMSG.swp" already exists!
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/XE0-ivLyDtAJ.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Wes Freeman
2012-08-07 03:56:08 UTC
Permalink
The "strange editing mode" is called vi. Check out this cheatsheet:
http://www.lagmonster.org/docs/vi.html

To edit, type "i" to switch to insert mode. To leave insert mode, hit ESC.
To save and quit, type :wq<Enter>, which means "write, quit".

Good luck!

Wes
Post by Jeffery Brewer
I've slowly been trying to get git to work and just running into loads of
problems.
Using the windows bash I just tried to do a commit this evening and forgot
to add a message (e.g. -m "my work for today") and sent the bash into some
sort of odd editing mode that I can't seem to get out of. I finally just
closed the bash and opened a new bash and tried to commit and got all kinds
of error messages with a prompt to type (R) to recover. Typed R to recover
and it took me right back into the strange editing mode that I can't seem
to get out of now. I've backed up all the files in the directory (sensing
an impending catastrophe) but not sure what else to do at this point to get
git running again.
Any help would be appreciated.
More detail...
If I open a new bash in the directory and run "git commit" I'm getting
E325: ATTENTION
Found a swap file by the name ".git\.COMMIT_EDITMSG.swp"
dated: Mon Aug 06 19:45:14 2012
C:/Users/me/Documents/NetBeansProjects/foldername/.git/COMMIT_EDITMSG
modified: YES
user name: me host name: my computer
process ID: 10368
While opening file ".git\COMMIT_EDITMSG"
dated: Mon Aug 06 19:55:29 2012
NEWER than swap file!
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r .git\COMMIT_EDITMSG"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file
".git\.COMMIT_EDITMSG.swp"
to avoid this message.
Swap file ".git\.COMMIT_EDITMSG.swp" already exists!
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit
--
You received this message because you are subscribed to the Google Groups
"Git for human beings" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/git-users/-/XE0-ivLyDtAJ.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/git-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Daniel P. Wright
2012-08-07 04:03:39 UTC
Permalink
Hello,

Jeffery Brewer (Mon, Aug 06, 2012 at 07:57:13PM -0700) >>
Post by Jeffery Brewer
I've slowly been trying to get git to work and just running into loads of
problems.
Using the windows bash I just tried to do a commit this evening and forgot
to add a message (e.g. -m "my work for today") and sent the bash into some
sort of odd editing mode that I can't seem to get out of. I finally just
closed the bash and opened a new bash and tried to commit and got all kinds
of error messages with a prompt to type (R) to recover. Typed R to recover
and it took me right back into the strange editing mode that I can't seem
to get out of now. I've backed up all the files in the directory (sensing
an impending catastrophe) but not sure what else to do at this point to get
git running again.
Any help would be appreciated.
The default editor for git is vim, which is a sensible choice as its
available on nearly every platform, but if you've never encountered it
before it can seem a little... unusual.

A little more information on it is at the wiki page here:
http://en.wikipedia.org/wiki/Vim_(text_editor)
And an introduction to its use can be found here:
http://blog.interlinked.org/tutorials/vim_tutorial.html
(First hit on google; I haven't read it so can't vouch for its quality)

The gist of it is: Press "i" to enter "insert" mode, which will let you
type. Press "esc" to exit that mode. In "normal mode" (after pressing
esc) type ":wq" to write your changes to file and quit.
Post by Jeffery Brewer
More detail...
If I open a new bash in the directory and run "git commit" I'm getting this
E325: ATTENTION
Found a swap file by the name ".git\.COMMIT_EDITMSG.swp"
dated: Mon Aug 06 19:45:14 2012
C:/Users/me/Documents/NetBeansProjects/foldername/.git/COMMIT_EDITMSG
modified: YES
user name: me host name: my computer
process ID: 10368
While opening file ".git\COMMIT_EDITMSG"
dated: Mon Aug 06 19:55:29 2012
NEWER than swap file!
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r .git\COMMIT_EDITMSG"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".git\.COMMIT_EDITMSG.swp"
to avoid this message.
Swap file ".git\.COMMIT_EDITMSG.swp" already exists!
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit
These warnings are vim warnings and not git ones. They're telling you
that vim ended unexpectedly (when you force-closed the window) while you
were editing a file, so there's a backup you can recover. Clicking
recover opens the backup so that you can edit it again.


Having said all this, you can change the text editor using the following
command-line:

git config --global core.editor "notepad"

Obviously changing "notepad" to something more sensible first(!)

Vim is a very good editor and I recommend learning it. I believe the
"Cream" distribution is popular with Windows people:

http://en.wikipedia.org/wiki/Cream_(software)

It is an entirely separate thing from git however, and there is an
argument for learning the two tools separately, in which case perhaps
changing the editor to something you're more comfortable with until you
feel happy with git would be a good idea.

Dani.
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
PJ Weisberg
2012-08-07 15:46:07 UTC
Permalink
Post by Daniel P. Wright
The default editor for git is vim, which is a sensible choice as its
available on nearly every platform, but if you've never encountered it
before it can seem a little... unusual.
I'm not sure a text-editor is "sensible" if a newbie *can't figure out what
it is*. The only reason to make it the default IMO is that it
*is*available on every system (except Windows). On Windows, I think a
sensible
default would be Wordpad. Of course, no one asked me my opinion. :-)

P.S.: Here's the minimum you need to know about vim:

It starts in "command mode"
To enter text, you need to be in "insert mode"
Switch from command mode to insert mode by pressing "i"
Switch from insert mode to command mode by pressing "ESC"
In command mode:
save by typing ":w"
quit by typing ":q"
save and quit by typing ":wq"
quit without saving by typing ":q!"

-PJ

Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Jeffery Brewer
2012-08-07 18:45:12 UTC
Permalink
Thanks very much for all the help. I'm going to play around with this
tomorrow when I get back on the computer all that is on.
Post by PJ Weisberg
Post by Daniel P. Wright
The default editor for git is vim, which is a sensible choice as its
available on nearly every platform, but if you've never encountered it
before it can seem a little... unusual.
I'm not sure a text-editor is "sensible" if a newbie *can't figure out
what it is*. The only reason to make it the default IMO is that it *is*available on every system (except Windows). On Windows, I think a sensible
default would be Wordpad. Of course, no one asked me my opinion. :-)
It starts in "command mode"
To enter text, you need to be in "insert mode"
Switch from command mode to insert mode by pressing "i"
Switch from insert mode to command mode by pressing "ESC"
save by typing ":w"
quit by typing ":q"
save and quit by typing ":wq"
quit without saving by typing ":q!"
-PJ
Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/A2PMxmLnIJoJ.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Philip Oakley
2012-08-07 06:48:02 UTC
Permalink
----- Original Message -----
From: Jeffery Brewer
To: git-users-/***@public.gmane.org
Sent: Tuesday, August 07, 2012 3:57 AM
Subject: [git-users] Beginner stuck in a commit


I've slowly been trying to get git to work and just running into loads of problems.

Using the windows bash I just tried to do a commit this evening and forgot to add a message (e.g. -m "my work for today") and sent the bash into some sort of odd editing mode that I can't seem to get out of. I finally just closed the bash and opened a new bash and tried to commit and got all kinds of error messages with a prompt to type (R) to recover. Typed R to recover and it took me right back into the strange editing mode that I can't seem to get out of now. I've backed up all the files in the directory (sensing an impending catastrophe) but not sure what else to do at this point to get git running again.

Any help would be appreciated.
Others have mentioned that you are in one of those unfathomable Unix terminal editors ;-) Assuming/If you are on Windows...

I'd suggest that you set up your configuration to use Notepad++ (a lovely open source editor). There is a Stackoverflow page with details.
Set up your .gitconfig (mine's in C:\Documents and Settings\Philip\.gitconfig) as

[core]
editor = 'C:\\Program Files\\Notepad++\\notepad++.exe' -multiInst -notabbar -nosession -noplugin

More detail...

If I open a new bash in the directory and run "git commit" I'm getting this error message:

E325: ATTENTION
Found a swap file by the name ".git\.COMMIT_EDITMSG.swp"
dated: Mon Aug 06 19:45:14 2012
file name: C:/Users/me/Documents/NetBeansProjects/foldername/.git/COMMIT_EDITMSG
modified: YES
user name: me host name: my computer
process ID: 10368
While opening file ".git\COMMIT_EDITMSG"
dated: Mon Aug 06 19:55:29 2012
NEWER than swap file!
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r .git\COMMIT_EDITMSG"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".git\.COMMIT_EDITMSG.swp"
to avoid this message.
Swap file ".git\.COMMIT_EDITMSG.swp" already exists!
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit

--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/XE0-ivLyDtAJ.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2197 / Virus Database: 2437/5181 - Release Date: 08/06/12
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Antony Male
2012-08-08 20:29:00 UTC
Permalink
Post by Philip Oakley
I'd suggest that you set up your configuration to use Notepad++ (a lovely
open source editor). There is a Stackoverflow page with details.
Set up your .gitconfig (mine's in C:\Documents and
Settings\Philip\.gitconfig) as
[core]
editor = 'C:\\Program Files\\Notepad++\\notepad++.exe' -multiInst
-notabbar -nosession -noplugin
If you're not confident setting this up, Github wrote a little program,
available as a .exe from [1], which sets notepad as the default git editor.

Antony

[1]: https://github.com/blog/975-gitpad-write-your-commits-in-notepad
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/QJicouvpWxwJ.
To post to this group, send email to git-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to git-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
Loading...