How to make emacs work with git text coloring?

In my current development environment, when I run git rebase interactively ( --interactive ), it often opens vi and invites me to make changes to some text file as a way to tell me how to handle rebase. vi highlights these files in a way that git seems to define. (Keywords such as "pick", "squash", etc., which have a special meaning for git in this context, are highlighted in different colors.)

I prefer to use emacs over vi, so I configured git to open emacs instead ( git config --global core.editor "emacs -nw" ). Unfortunately, emacs does not highlight the file provided by git, as vi does. How can i fix this?


Edit:

If you are not familiar with a file created using interactive git rebase, here is an example:

 pick f218f23 A major overhaul of the cucumber integration tests pick 601d8f4 A bunch of minor bug fixes and refactoring pick 1adc507 Adding and updating documentation for various files. # Rebase ff8cb22..1adc507 onto ff8cb22 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit log message # x <cmd>, exec <cmd> = Run a shell command <cmd>, and stop if it fails # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. c:\my_project\.git\rebase-merge\git-rebase-todo [unix] (15:50 26/10/2012) 

In this example, the β€œpick” keyword, hashing changes, commit descriptions, and comments will be highlighted in different colors.

+4
source share
2 answers

Either there is a mode for it somewhere already (for example, as part of magit), or someone will have to write one for it (it should be quite easy if you show us sample content, as well as some hint about what file name they have).

+3
source

http://bogolisk.github.com/egg/egg-log-rebase.png

The egg has built-in support for interactive reloading. You first select the commits in the DAG,, then run the interactive rebase.

- http://bogolisk.github.com/egg/

0
source

Source: https://habr.com/ru/post/1442399/


All Articles