Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git difftool in read write mode

Tags:

git

vim

I have the following configuration in my ~/.gitconfig

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

When I launch git difftool it opens up the buffers in read-only mode by default. I use it to review the changes before a commit and say I find some small change like a commented out line I have not removed or a JS console.log statement, I am forced to quit the tool and open the file and make the change. I would very much like a way to do the change within the visual diff window itself.

http://gitlog.wordpress.com/2011/03/30/git-1-7-4-2/ says that "“git difftool” didn’t tell (g)vimdiff that the files it is reading are to be opened read-only." From this I figure that this read-only behavior was desired.

  1. I am curious to know why having a read-only behavior in difftool was chosen as the default.

  2. Is there any way I can configure the difftool to allow read/write?

  3. From git, vimdiff and dirdiff, I see that fugitive plugin for vim and git diffall script are also available as alternatives to make this diff reviewing process easier. Will using fugitive open up the possibility of using a read/write visual diff mode?

like image 481
Ramnath Avatar asked Dec 15 '22 11:12

Ramnath


1 Answers

If you aren't using fugitive, you can toggle read-only mode (per pane!) with

:set readonly!

or

:set ro!
like image 157
djeikyb Avatar answered Dec 21 '22 10:12

djeikyb