Git diffftool in read mode

I have the following configuration in my ~ / .gitconfig

[diff] tool = vimdiff [diftool] prompt = false 

When I run git diffftool, it opens buffers in read-only mode by default. I use it to check the changes before committing and say that I find a small change, for example, a missing line that I did not delete, or the JS console.log instruction, I have to leave the tool and open the file and make changes. I would really like the way to make changes inside the visual comparison window itself.

http://gitlog.wordpress.com/2011/03/30/git-1-7-4-2/ says that "git difftool" did not tell (g) vimdiff that the files it reads are openable read-only. "From this, I believe this read-only behavior was desirable.

  • I am curious to know why the default is read-only behavior in diffftool.

  • Is there a way to configure diffftool to read / write?

  • From git, vimdiff and dirdiff , I can see that a hidden plugin for vim and git diffall script is also available as an alternative to simplify this process of analyzing the differences. Will the use of lurking features open up the possibility of using the reading / writing mode of visual differences?

+4
source share
2 answers

Fugitive will let you modify the working copy file while it is different. Just run :Gdiff and a vertical split will appear with the index version. Now you can :diffput (or short dp ) inside the working copy put the piece in the index file or, alternatively :diffget (or short do ) from the index file to get a piece from the working copy. If you have everything you need in the index file, save it and now it will be your hidden version.

What really helped me understand the process was vimcasts from 31 to 35 about Fugitive.vim:
http://vimcasts.org/episodes/archive

+3
source

If you are not using a fugitive, you can switch the read-only mode (to the panel!) With

 :set readonly! 

or

 :set ro! 
+4
source

All Articles