Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After Git Revert command I can't use the command line / git

I'm doing a git revert on a commit using git revert [commit number]

Real life example being:

git revert 58c128313e353b8dd7d04121824b966faefe68dc

After I do this it takes me to the screen where it shows me the revert message, but I can't exit this screen and I can't type anything.

I've tried pressing Q which is how I quit the git log screen, but this doesn't work either. When I force quit terminal and go back in, the revert has taken place.

How do I do a revert and then got back to the command line and carry on working as usual?

Screenshot

Here is the screenshot of what it is saying

like image 671
The Chewy Avatar asked Feb 09 '17 20:02

The Chewy


1 Answers

You are in the vi or vim editor, which is the default on many Linux distributions.

To save the file and exit, thus completing your revert, type:

Esc:wqEnter

Or you can abort the editor without saving, if you prefer that:

Esc:q!Enter

You can avoid this editor in the future if you wish. Find an editor you do want to use (emacs, nano, joe, whatever...) and set it as your default instead. You can do that in your shell file (e.g. .bash_profile) like this:

export EDITOR=/usr/bin/nano
export VISUAL=$EDITOR
like image 86
Dan Lowe Avatar answered Sep 22 '22 03:09

Dan Lowe