Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enable color highlighting for interactive git rebase on mac

Tags:

git

Color highlighting works for everything else in git (e.g. status, log, branch name etc). Just not when I do an interactive rebase.

This sort of makes sense because interactive rebase happens within a text editor, where other interactions are just terminal output. But I think I remember highlighting working by default in git bash on windows, so there must be a way on mac.

I would like it to color code pick vs squash vs fixup etc.

As a shot in the dark, I tried setting color param interactive to true and auto in my ~/.gitconfig, and tried supplying some color values explicitly, but this had no effect:

[color]
    branch = auto
    diff = auto
    status = auto
    ui = auto
    interactive = true
[color "interactive"]
    pick = yellow
    squash = green
    fixup = cyan
like image 444
dstandish Avatar asked May 30 '18 19:05

dstandish


People also ask

How do I get to interactive in rebase mode?

Changing Multiple Commit Messages You can run rebase interactively by adding the -i option to git rebase . You must indicate how far back you want to rewrite commits by telling the command which commit to rebase onto.

How do I rebase in Mac terminal?

you may just run git pull --rebase origin stagingonly to rebase all your commits onto latest state of remote version stagingonly branch. It will look like you just created your feature branch and put all you commits after latest ones from team branch.

How do I rebase a reword in git?

On the command line, navigate to the repository that contains the commit you want to amend. Use the git rebase -i HEAD~n command to display a list of the last n commits in your default text editor. Replace pick with reword before each commit message you want to change.


1 Answers

The highlighting in an editor is not controlled by git's configuration. Highlighting works by default in git bash because it comes with a vim pre-configured with git syntax files.

Assuming you are using vim for the git editor on mac, first try enabling vim syntax highlighting by adding syntax on to ~/.vimrc.

Failing that, you may need to download and install git syntax files.

like image 195
jingx Avatar answered Oct 02 '22 02:10

jingx