All Questions
463
questions
3354
votes
35
answers
1.4m
views
How do I make git use the editor of my choice for editing commit messages?
How do I globally configure git to use a particular editor (e.g. vim) for commit messages?
323
votes
7
answers
352k
views
How do I exit from the text window in Git?
I am using Windows and before committing, Git wants me to enter a text message and a new text window appears.
How can I exit from this?
I am trying to learn Git. So, a little help will be highly ...
295
votes
13
answers
144k
views
git ignore vim temporary files
What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?
287
votes
7
answers
186k
views
Vim for Windows - What do I type to save and exit from a file?
Using Windows XP I accidentally typed git commit -a instead of git commit -am "My commit message", and now I'm viewing my CMD prompt filled with the file version of my commit message ("Please ...
256
votes
5
answers
160k
views
Viewing all `git diffs` with vimdiff
I setup git diff to wrap into vimdiff, using "Git Diff with Vimdiff" as a guide, and it's working as expected unless there are many files with changes.
When there are multiple files with changes and ...
245
votes
3
answers
116k
views
How do I use vimdiff to resolve a git merge conflict?
I just merged a branch into my master in git and I got Automatic merge failed; fix conflicts and then commit the result. Now I ran git mergetool and vimdiff opened with the image below. I don't know ...
233
votes
6
answers
230k
views
Git commit in terminal opens VIM, but can't get back to terminal
Trying to learn GitHub at the moment and doing this Git essentials tutorial over at nettuts. I'm on the lesson about making commits.
The teacher types git commit and it opens VIM as his editor (I'd ...
198
votes
5
answers
77k
views
How to abort a git rebase from inside vim during interactive editing
When I do an interactive rebase, e.g.
git rebase -i HEAD~3
the rebase interactive editor (vim in my case) opens to let me edit the commits to rebase
pick c843ea2 Set Vim column limit to 80 (OS X)
...
163
votes
8
answers
40k
views
How can I visualize per-character differences in a unified diff file?
Say I get a patch created with git format-patch. The file is basically a unified diff with some metadata. If I open the file in Vim, I can see which lines have been modified, but I cannot see which ...
161
votes
14
answers
48k
views
Could not execute editor
I don't often have to modify multiple commit messages, but it has happened once or twice and I don't ever remember seeing this. I hope someone else has. When I git rebase -i HEAD~7, the expected list ...
133
votes
3
answers
70k
views
How to make vi redraw screen?
When I use
git commit --amend
It will enter into a vi window to let me input comments for commit, the problem is the vi windows will show some dirty characters from former shell background. So I ...
125
votes
7
answers
161k
views
Using git commit -a with vim
I'm new with git, so I decided to learn git using the tutorials of github. The third chapter said:
"For this first example we’ll modify the README file to add ourselves as an author on the project....
124
votes
5
answers
27k
views
Refresh all files in buffer from disk in vim
The command to refresh a file from version on disk is :e!
How can I do the same for all files in the buffer?
Background: I need that because I am using git with multiple branches with one vim open ...
123
votes
1
answer
21k
views
Git command output is in editor (vim) and not directly to terminal output [duplicate]
I don't know why but the output from some git command are in editor (vim) and not directly to the terminal output.
For example, the command git branch open vim and list the branches but I would like ...
120
votes
14
answers
30k
views
Highlight changed lines and changed bytes in each changed line
Open Source project Trac has an excellent diff highlighter — it highlights changed lines and changed bytes in each changed line! See here or here for examples.
Is there way to use the same ...
92
votes
7
answers
36k
views
Automatically wrap long Git commit messages in Vim
Using Git, my editor for commits is Vim. I'm constantly doing a poor job of remembering to wrap lines and so I get long lines (see this answer for example). Is there a way using some git config or ....
68
votes
4
answers
32k
views
git rebase --editor=/something/other/than/vim? (for easier squashing)
I happily use vim as my default editor for commits, and do not wish to change it. However, when it comes to rebasing, I find myself squashing dozens and dozens of commits which I find much easier with ...
65
votes
4
answers
24k
views
Exit Vim without committing changes in Git [duplicate]
When I use git commit --amend or git rebase -i, vim opens up for me to make changes. If I then change my mind and exit vim without making any changes, a commit is still made which shows up in git ...
64
votes
4
answers
56k
views
How to add commit message using vim?
I want to add a commit message using vim (or nano, or any other text editor) rather than writing it in the command line using git commit -m.
How I can do this?
61
votes
5
answers
24k
views
Adding your .vim ~/.vimrc to github (aka dot files)
I have seen a few people that have git repos with their dot files. I'm wondering if they just
cd ~/
git init
git add .vimrc
// etc
? And then that's how they keep it up to date? Or do they probably ...
61
votes
4
answers
21k
views
.gitignore files added inside Git submodules
I recently reorganized my dotfiles to live inside a Git repository at ~/Dropbox/dotfiles and I'm using pathogen to bundle all Vim addons inside ~/Dropbox/dotfiles/home/.vim/bundle. These addons were ...
51
votes
5
answers
12k
views
Using vim for git commit messages broken after updating janus
After updating the janus vim distribution there appears to be a problem with using vim for commit messages. The best example of this is when doing a git pull to get someone else's changes. The vim ...
43
votes
5
answers
72k
views
The "git" command requires the command line developer tools. Would you like to install?
I'm super new to coding (actually trying to teach myself some Python), but there's a thing bugging me that I cannot seem to find any info online about my particular case: When I run git on the ...
40
votes
2
answers
29k
views
Git: cancel an interactive rebase
I like to git rebase -i HEAD~5 to squash my commits down. Sometimes I think I need to go back 5 commits but then realize I need 7. However git has already brought up the rebase editor .git/rebase-...
34
votes
5
answers
11k
views
Git commit fails with Vim and GVim
When I try to do a git commit -a, I get a nice vim instance. I type in my message, do :wq, vim closes down and the terminal has the message,
Aborting commit due to empty commit message.
Pursuant to ...
31
votes
8
answers
17k
views
How to use Vim to quickly see Mercurial or Git changes
As I'm editing a file in Vim, I would like to quickly highlight any changes I have made since my last commit, while still being able to edit the file. Is there anything that comes close to doing this?...
31
votes
3
answers
3k
views
Git commit messages lost by vi
I'm a clumsy typist, and I don't use vi/vim very often, but I do use it for commit messages. However, if you type a wrong command while editing a commit message (:Wq, say, instead of :wq), when you ...
30
votes
4
answers
42k
views
git commit -a confusion
I am using Git Bash and am trying to figure out what is happening when I type 'git commit -a'.
Looks like VIM opens up to edit my commit message but how do I save and actually complete this commit? ...
30
votes
4
answers
29k
views
Git-commit unable to open vim
Recently I installed bash-it into my terminal. Now, when I try to execute git commit the terminal shows me this error:
/usr/bin/mate -w: /usr/bin/mate: No such file or directory
error: cannot run /...
30
votes
5
answers
14k
views
Why does git mergetool open 4 windows in vimdiff? (I'd expect 3)
When I met a conflict, I tried to use git-mergetool to solve it. I typed:
>git mergetool -t vimdiff
It opened vimdiff in 4-way, not 3-way. My split windows in vimdiff look like:
:ls
1 #a "...
30
votes
3
answers
7k
views
Git: Recover failed commit's message
Every now and then, as I am dutifully crafting a nice, descriptive commit message, I get an error:
".git/COMMIT_EDITMSG" 81L, 2108C written
error: There was a problem with the editor 'vim'.
Please ...
28
votes
2
answers
31k
views
Adding a git commit message using vi on OS X
I'm learning using Git on an OS X Terminal. It seems really easy. But I can't handle just one problem: When I try to merge two branches, for example "myTestBranch" into "master" this program covers ...
27
votes
4
answers
13k
views
Vim:Fugitive:Glog - How to get commits for current file rather than revisions
Currently, if I type :Glog I get the list of revisions for the current file.
If I type :Glog -- I get the list of commits for all files.
What do I need to type to get the of commits for the current ...
26
votes
2
answers
5k
views
vim says "No mouse support", but only when I run git commit
I like using the mouse with vim, so I have mouse support enabled in my .vimrc. This works just fine most everywhere, but whenever I run git commit on a specific server (Appa), I get an error message:
...
26
votes
5
answers
8k
views
vim not working when calling git commit within cygwin
I am using git within Cygwin 64 under windows. The default editor vi and git uses the default editor. When I call 'git commit' following messages will be prompted before vim is started:
git commit
...
25
votes
2
answers
23k
views
git: new blank line at EOF
So I run git diff --check before add-ing files and commit-ing them, and on two specific files I get path/filename:linenumber: new blank line at EOF. If I delete the last empty line in those files, I ...
25
votes
2
answers
18k
views
Where is vimrc or vim profile for github's mingw32 shell on a Windows machine?
Cygwin has a home directory where I can store a .vimrc file to set up syntax highlighting. I know on linux machines this file is usually in a home directory and that it can be stored globally (...
24
votes
2
answers
13k
views
How can I commit files currently displayed in Vim with fugitive?
I am editing files opened split into three windows. I want to commit those into the repository. Is there any commands to do that?
24
votes
4
answers
8k
views
git, vimdiff and dirdiff
I'm trying to use vimdiff+dirdiff.vim to diff inside Vim multiple files versionned with Git.
For Mercurial, it is possible with mercurial extdiff extension.
The only way I found on the web to ...
22
votes
1
answer
13k
views
Netbeans 7 vs Eclipse 3.6 for Java, git and vim [closed]
Both of them have a lot of features and are very popular, but which is better?
To reduce subjective answers, please answer this points:
Code Refactoring.
Unit testing, debugging.
Git support.
Vim ...
21
votes
4
answers
9k
views
vimdiff between current and previous git version of a file
Is there a way of using vimdiff to compare the current version of a file and the same file n git versions ago?
For example, I'm working on the file foo.c on the branch master. I'd like to do a ...
21
votes
3
answers
18k
views
Git Commit after merge opens VIM
I did a merge of 2 files and now Im trying to commit but it opens VIM with the following data and now I'm completely lost. (I have no experience with VIM)
Merge branch 'master' of nodester.com:/node/...
21
votes
1
answer
12k
views
What's the difference between vimdiff and vimdiff2 in git?
What's the difference between them? My search engine results talk only about vimdiff, yet the command
git mergetool
offers me both.
20
votes
3
answers
6k
views
How do you cancel an external git diff?
I've got vim setup as my external diff tool:
[diff]
external = git_diff_wrapper
#!/bin/sh
vimdiff "$2" "$5"
Say I have 300 files that have been modified; via bash, I type "git diff". It ...
20
votes
6
answers
6k
views
git rebase -i presents an empty MacVim file
I'm trying to rebase a commit. However, any time I run git rebase -i f83eff3ffc8, for example, a MacVim window opens, that's empty (there is no information in the file). Then once I write and close ...
19
votes
4
answers
8k
views
How to open all modified files with git?
How to open all deleted, modified, and created files since the last git commit, I tried using git status first, but it was difficult to parse, so I found git status --porcelain was easier to parse and ...
19
votes
1
answer
16k
views
How do I jump to the next/prev diff in GIT difftool?
I am using git difftool to compare 2 large files in VIM. I want to navigate only to the lines that differ.
How do I navigate quickly between lines that differ using GIT difftool ?
I am looking for ...
19
votes
3
answers
14k
views
`git add` adds ^M to the end of every line
I'm on Ubuntu 14.04. I'm editing files with Vim. Suddenly I started to notice that the changes that I make which I see with git diff filename contain ^M at the end of every line that I've inserted or ...
18
votes
2
answers
13k
views
Git commit -a opens GNU nano 2.2.6 How should I change it to open Vim instead?
I am trying to add a commit message to my changes using
git commit -a
OR just plain
git commit
this somehow opens GNU Nano 2.2.6 editor and I am not at all comfortable with it. So the question ...
18
votes
3
answers
8k
views
Making vim show a git diff with colors like a git diff command (red-delete, green-add)
I ran git config --global alias.ci commit --verbose
This makes it so running git ci is like running git commit --verbose
The --verbose flag shows a diff in the commit message template, which is not ...