16

I have problems with using my GIT. Everything works fine when running the CMD and the '$' shows up and my text shows up. But when i go to my git log my text suddenly dissapears, It's just a ':' and i can type commands but not see them.

When i go out from the git log the text still is not appearing. I have a picture in my link below.

If i type CTRL+C 2 times i can see the '$' sign but the text is still gone.

Git-text-dissapear-picture

Kerpalito
  • 177
  • 1
  • 8
  • 2
    Well, the picture you have linked just show the correct `git log` behavior. You just need to hit the q on your keyboard to quit the pager that `git log` is using to output the info. I don't understand the problem of the gone text, did you try to scroll up? – YoannFleuryDev May 31 '17 at 10:04
  • 1
    When i type in commands i can't see what i'm typing after visiting the git log. Even if i press Q i can see the $ sign but still i can't see my text when i'm typing even though i could see it before i visited the log. – Kerpalito May 31 '17 at 10:10
  • I think this is not a git problem. This seems to be a problem with your command prompt or your configuration. – YoannFleuryDev May 31 '17 at 10:12
  • It is a bug in bash (not git) on Windows (MINGW64) with hitting Ctrl-C while in the pager. Using `q` as suggested exits the pager nicely and characters typed will be echoed normally. – Abel Jun 28 '18 at 20:22

4 Answers4

49

I had this problem after exiting git log in windows git bash today, i fixed it by resetting the terminal using reset.

Rhys Bevilaqua
  • 2,102
  • 17
  • 20
  • 3
    This should be the accepted answer! While the accepted answer provides a lot of info, it doesn't explain that on Windows, echoing to the screen in bash is destructed by `less`. Using `reset` (typing it, even though you won't see it) fixes this. – Abel Jun 28 '18 at 20:17
  • confirmed, this is definitely the answer! just had this exact issue and solved easily with reset – user3376851 Mar 08 '22 at 15:47
10

To exit the git log interface you must type :q.

Using Ctrl-C to exit less or another pager, will lead to the characters being swallowed (that is: not echoed to the screen). Using q will exit it nicely and the bash prompt will echo what you type.

Abel
  • 56,041
  • 24
  • 146
  • 247
ahidri
  • 129
  • 3
  • 1
    Not sure why this was downvoted. If you use `q` instead of `Ctrl-C`, your prompt echoes the characters normally. Using `Ctrl-C` will swallow any character and only `reset` gets them back. – Abel Jun 28 '18 at 20:19
  • I think this should be the choosen as the most accurate answer – EmilianoPe Jun 06 '19 at 20:35
4

git log uses your configured pager to display one screen of information at a time.

The default pager on Unix-based systems nowadays is less and this is probably also the pager on your system. I guess you are using Git Bash which is just a bunch of Linux programs ported to work on Windows.

less displays a screen of information and on the last line of the terminal window it displays the : prompt, waiting for a command. It has several commands you can learn about if you press h at the prompt.

The most used less commands are:

  • f or <space> to display the next screen (f comes from "Forward");
  • b to display the previous screen (b comes from "Backward");
  • / followed by a regular expression and enter to search for matching substrings in the input data, starting with the displayed screen (search forward);
  • ? followed by a regular expression and enter to search backward;
  • h to display the help (the list of commands);
  • q to quit.

Most commands have two or more keys assigned. I listed above only on key which is also the easiest to type.

You can use the less commands when you read its help (it is more than one screen).

If i type CTRL+C 2 times i can see the '$' sign but the text is still gone.

On quit, less restores the screen in the status it found it when it started.

In order to use a different pager program (for all Git commands that require one) you can set it in the Git config:

git config core.pager /bin/more

Replace /bin/more in the command above with the full path of you favorite pager program.

axiac
  • 68,258
  • 9
  • 99
  • 134
  • Thanks for your solution, but I can't apply it! Would you kindly clarify what you mean by "favorite pager program"? put an example if possible. – Mohammad ElNesr Jun 03 '18 at 12:08
0

I have faced the same problem after using the $ git log command

I have fixed this after using a reset command in the CLI, things are back to normal.

Note: Just reset the Git bash even though if you can't see the text the command will execute anyways.

AV Reddy
  • 11
  • 4