i'm using oh-my-zsh and terminal command on VSCODE or iTerm on macos machine.
some commands doesn't release or exit ( i have no idea how it's called sorry )
for example
git status print the status and i can input other command after it.
git branch print the branch but i have to do press control + C + ": q" to exit . few times ago it print the text and i can input other commands without ": q"
any one have an idea from where it can come or fix ?
thanks
Based on the fact that git status works fine, but git branch sometimes doesn't, I'm going to guess that you've got your git pager set to something vi-like.
That is: the output from git status is usually pretty short, but the output from git branch takes more than one screenful, and needs scrolling.
What do the following commands show?
echo $PAGER
git config --get core.pager
For more about git paging, you could start here: https://medium.com/pragmatic-programmers/git-config-core-pager-807e17d64243
Related
I want to merge a remote repository to a new repository on GitHub. I have tried the following bash commands:
git init
git commit --allow-empty -m "Initial dummy commit"
git remote add --fetch old_a <OldA repo URL>
git merge old_a/master --allow-unrelated-histories
After executing the last command, this screen pops up:
Here bash is asking me to enter a commit message. But typing appears to be prohibited everywhere except in the yellow line. Not only that, I can't even terminate this prompt if I want to go back to the command line. There seems no way to break out other than closing bash itself. So how do I proceed from here?
PS: I have already tried to change my default git editor to vim using the following commands:
git config --global core.editor vim
As well as,
export EDITOR="vim"
But both of these commands didn't work.
This is not an issue, all you need to do is
Press Insert Key and then Enter Key. This will allow you to type a message
Once you have done that Press Esace (Esc) then :wq to exit
For some reason,
whenever I want to run a git command and use tab completion to achieve something like :
$git checkout master
When I press tab after writing git checkTab, something hello -n is being written automatically, so it results in
$git checkhello -n
I can't use git CLI with tab completion because of this. Does anyone know what's going on here?
Checked my aliases in .bashrc, one of the alias had the term 'hello' echoed in it. Removing it solved the problem.
So, I have reproduced it. Running:git ls-files|grep navbar.html|xargs vim
in my Git Bash and exiting vim making my Git Bash not accept keyboard inputs anymore. However my other Git Bash windows working fine.Any ideas how can I get arround this problem?
If you execute reset, it will be fixed.
This is a common vim usage error (see also https://unix.stackexchange.com/questions/77395/grep-l-xargs-vim-generates-a-warning-why). This command will do what you want:
git ls-files | grep navbar.html | xargs sh -c 'vim "$#" <$0' /dev/tty
Sometimes like when you are not on full screen and you insert command like
git log | git diff
or something like them that need a bigger window size to show bunch of data you'll get colon sign
:
that is for displaying data summary and you can scroll data to see more by using arrow keys.
at the end you can quit this mode using q key
press "Q" keyword to exit.
When I try to use "git difftool", the terminal seems to enter a mode where hitting the "enter" key outputs ^M instead of accepting the default option:
$ git difftool --tool=tkdiff file
Viewing (1/1): 'file'
Launch 'tkdiff' [Y/n]: ^M^M^M^M^M^M^M^M
I can control-c out of it, but I can't get difftool to work.
"git diff" works like a charm.
I am struggling to Google for this problem.
I am running Ubuntu 14.04.2 LTS, my TERM is xterm, and my .gitconfig is very simple, it has nothing about output in it:
[user]
name = My Name
email = myemail#example.com
[alias]
co = checkout
How can I use "git difftool"?
Probably a terminal configuration problem rather than a git issue. Run stty sane to see if that helps or follow other instructions in this similar post: https://askubuntu.com/questions/441744/pressing-enter-produces-m-instead-of-a-newline
I'm using Github and Git bash on my Windows PC (running XP).
On Ubuuntu I'm happyily using git grep to plough through my code, but every time I call something like:
git grep "some text in my repo"
on Windows I get the results and afterwards I'm stuck with the bash window showing all kind of things [END], ~, [RETURN]... whenever I try to enter something.
Question:
What else besides CTRL+R, CTRL+Q, FN+END, Q, ESC can I try to not having to force-close and reopen git:bash in order to continue to work.
Thanks!
EDIT:
This is what I mean:
As soon as I start typing, the [END] string re-appears (or 50 lines ~) and I cannot write any command on Git, because whatever is in the way swallows half of what I'm typing.... nice description...
I was wondering about this also after installing git and running git bash. It seems "git grep" pipes commands through "less".
Solution: Just type q.
Is git launching less (or something similar) so up/down arrows on your keyboard scrolls through the matches? If you don't want that, try the instructions from https://stackoverflow.com/a/12166923/972216:
set GIT_PAGER=cat
Would disable it for your console session once, or
git config --global core.pager cat
to disable it for your account.