As a long-time command-line Git user, I was hesitant to adopt RubyMine’s version control tools. But I decided to give them a try, and I’m glad I did. RubyMine’s version control tools make common Git commands more accessible and easier to execute. The addition of a GUI is great for tasks such as diffing a file, or viewing commit logs. In this post, we’ll look at performing everyday Git commands in RubyMine on OS X.
git-diff
You can view a diff of all your changes from the Changes tool window.
Press command + 9
to open the Changes tool window. Then press command + D
to view a diff of all your changes.
You can diff a single file by selecting “Compare with the Same Repository Version” from the VCS Operations popup. Press control + V
to open the VCS Operations popup.
git-commit
Press command + K
to commit changes.
git-push
Select “Push…” from the VCS Operations popup, control + V
, to push your local changes.
git-pull
Press command + T
to pull in the latest changes.
git-log
To view the Git log, open the Changes tool window, command + 9
, then navigate to the Log tab with command + shift + ]
.
To see the log of a single file, select “Show History” from the VCS Operations popup, control + V
.
This will open the log in the Version Control tool window.
git-checkout
Revert changes by selecting “Revert” from the VCS Operations popup, control + V
.
git-blame
Determine who changed a file by selecting “Annotate” from the VCS Operations popup, control + V
.
The committers will be displayed to the left of the editor gutter.
Don’t Abandon the Command-line
In this post, I focused on the most commonly used Git commands. RubyMine also includes support for more powerful Git commands, such as git-reset
and git-rebase
. However, I find their RubyMine GUI-based implementations slow and clumsy. As much as I want to stay in RubyMine, I find the best version control strategy is to use RubyMine for common Git commands, but turn to the command-line for the hard stuff.