GMA
GMA

Reputation: 6096

git add --patch shows "^m" when I hit return

Sometimes when I'm using git add --patch, my Return and arrow keys stop working - when I hit them I see weird symbols.

For example, here's what I see now if I run git add --patch and hit 'return', 'left', 'right', 'down', 'up' (with a space in between each key):

Stage this hunk [y,n,q,a,d,/,e,?]? ^M ^[[D ^[[C ^[[B ^[[A 

This is clearly some kind of encoding issue, but it's only happening in git commands that require user input such as patch - when I go back to normal terminal operation, things work fine again.

This happens to me at least once a day, and the only solution I've found is to close the terminal window and open a new one!

What's causing this and how do I prevent it?

Further details: I'm using zsh in Terminal on OS X 10.10.2. Within terminal Preferences, "text encoding" is set to UTF-8

Upvotes: 4

Views: 660

Answers (1)

Mike
Mike

Reputation: 156

Try to check you console configuration with stty -a If one of my flag is signed as icrnl I have no problem. If I change it to -icrnl the result is like yours.

To solve it just execute stty icrnl

You can even add it in your zsh profile.

You can also check this: https://askubuntu.com/questions/441744/pressing-enter-produces-m-instead-of-a-newline

Upvotes: 7

Related Questions