Stuck in Git-Bash command line?

Srijon
3 min readDec 22, 2018

--

This article is meant to help you with the inconvenience you may face while using vim and git-bash’s command line interface. Here, I would like to present some scenarios where people (especially windows users) get stuck and how to solve those.

Now, I’m discussing here about the scenarios where I got stuck. And this should cover most of the issues that a beginner face. But if there is a different issue that you have faced or that you want me to include in my article, feel free to respond. I’ll be happy to hear from you.

Encountering “(END)”

It is the first problem that I have faced. Usually, it happens when a git command returns you a lot of information. Here’s what $ git config -l produces-

In similar situations where we get a lot of information, we can keep on pressing enter until we get stuck with the following “(END)”.

how do I enter command now? :/

Solution: press ‘q’. This will enable you to enter command again.

Copy-Paste

In git, instead of Ctrl+C and Ctrl+V, we use Ctrl+Insert and SHIFT+Insert for copy paste purpose.

File name has a space

$ git add page1.html works just fine. But what if the file name was ‘first page.html’? In scenarios like this, we need to enclose the name within ‘’. So the command would be something like $ git add 'first page.html'.

Stuck in editor: Vim

If you followed my previous post or you kept the settings default, chances are Vim is selected as your editor in git. Now, I haven’t tried other editors so I’m discussing only about vim here. Git will open vim when-

  • you don’t add message while committing
  • you want to add ‘.gitignore’.
not using -m while committing will open up this editor (vim) for you

Once inside vim, you need vim’s command to use it. You can learn some commands from this document or form this video. However, the following commands should be enough for you to get going with your version control-

  • Start typing [i/a] : pressing ‘i’ or ‘a’ enables you to type in the editor. ‘i’ allows you to type before cursor (just like ms word) and ‘a’ lets you type after the cursor.
  • Stop editing [Esc] : after you are done with editing, press the escape button to exit from the writing mode.
  • Get back to normal console [:x] : If everything is complete and you want to get back to the git-bash terminal, simply type ‘:x’ and hit enter. ‘:x’ actually does two things — write and quit. Also, make sure you are not in the writing mode while performing this operation.

Well, that’s all for now. If you think I should add more or if you are stuck with an issue that isn’t covered here, don’t hesitate to respond.

--

--

Srijon

a passionate software engineer who also loves to write about things that he loves