How can I make Git open commit messages in RStudio on windows?

Viewed 143

In general I know that I can use git config --global core.editor "app" using the list of apps in the git documentation to change the default text editor in which commit messages are opened.

However, I primarily work in RStudio so I was messing around and trying to figure out if I can force commit messages to open in the RStudio text editor. But, my office machine is Windows and I am not used to the Windows command prompt, which does not have the open command that I am familiar with, so I cannot simply use "open -a RStudio" here.

When I set git config --global core.editor "start RStudio", the file opens, but Git returns an error that says "aborting message due to empty commit." So I try "start RStudio /WAIT" instead, but I get the same error AND a new RStudio window opens instead of the file opening in the same window. So then I tried "start RStudio /B /WAIT" instead and the same thing happens.

Is there a command I can use here that will open a commit message in the same RStudio window, and tell Git to wait for a response, or do I have to use one of the editors listed in the Git documentation?

1 Answers

I suggest using the git integrations directly in RStudio. Since you don't like clicking the mouse, learn the key bindings for Git operations:

Git/SVN

Description Windows & Linux Mac

Diff active source document Ctrl+Alt+D Ctrl+Option+D

Commit changes Ctrl+Alt+M Ctrl+Option+M

Scroll diff view Ctrl+Up/Down Ctrl+Up/Down

Stage/Unstage (Git) Spacebar Spacebar

Stage/Unstage and move to next (Git) Enter Return

(see the previous link for better formatting)

Related