简体   繁体   中英

Git: what is extra chars at the end of git branch name "?[m"?

Not able to delete all local branches. Some special characters are appended in the end and git throws following error:

git branch | grep -v "develop" | xargs git branch -D

error: branch 'anjum_br?[m' not found.
error: branch 'deploy_doc?[m' not found.
error: branch 'deploy_doc_fix?[m' not found.

I suggest you run git branch | grep -v "develop" | od -xcb git branch | grep -v "develop" | od -xcb git branch | grep -v "develop" | od -xcb to get a better representation of what you're seeing. ESC [ m (equivalent to ESC [ 0 m ) is the terminal sequence for resetting graphics rendition (coloring and other attributes).

The thing you will be looking for is hex 1b or octal 033 .

If that is the case, there's a good chance something is intercepting your streams and injecting these escape sequences into them. The most likely cause is your color.ui being set to always , as shown in the dump below when I set that flag:

0000340    6d5b    200a    6d20    7361    6574    1b72    6d5b    000a
          [   m  \n           m   a   s   t   e   r 033   [   m  \n
        133 155 012 040 040 155 141 163 164 145 162 033 133 155 012

You can see the escape sequence 033 [ m in the output stream in that case. Setting that flag to auto should use color if it detects output being sent to a terminal, no color otherwise:

git config --global color.ui auto

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM