|<<>>|76 of 274 Show listMobile Mode

Using Git efficiently: SmartGit + BeyondCompare

Published by marco on

Updated by marco on

I’ve written about using SmartGit (SG) before[1][2] and I still strongly recommend that developers who manage projects use a UI for Git.

If you’re just developing a single issue at a time and can branch, commit changes and make pull requests with your IDE tools, then more power to you. For this kind of limited workflow, you can get away with a limited tool-set without too big of a safety or efficiency penalty.

However, if you need an overview or need to more management, then you’re going to sacrifice efficiency and possibly correctness if you use only the command line or IDE tools.

I tend to manage Git repositories, which means I’m in charge of pruning merged or obsolete branches and making sure that everything is merged. A well-rendered log view and overview of branches is indispensable for this kind of work.

SmartGit

I have been and continue to be a proponent of SmartGit for all Git-related work. It not only has a powerful and intuitive UI, it also supports pull requests, including code comments that integrate with BitBucket, GitLab and GitHub, among others.

It has a wonderful log view that I now regularly use as my standard view. It’s fast and accurate (I almost never have to refresh explicitly to see changes) and I have a quick overview of the workspace, the index and recent commits. I can search for files and easily get individual logs and blame.

The file-differ has gotten a lot better and has almost achieved parity with my favorite diffing/merging tool Beyond Compare. Almost, but not quite. The difference is still significant enough to justify Beyond Compare’s purchase price of $60.

What’s better in Beyond Compare[3]?

Diffing

  • While both differs have syntax-highlighting (and the supported file-types seem to be about the same), Beyond Compare distinguishes between significant and insignificant (e.g. comments or whitespace) changes. It makes it much easier to see whether code or documentation has changed.
  • The intra-line diffing in Beyond Compare is more fine-grained and tends to highlight changes better. SmartGit is catching up in this regard.
  • You can re-align a diff manually using <key>F7</key>. This is helpful if you moved code and want to compare two chunks that the standard diff no longer sees as being comparable

Merging

I could live without the Beyond Compare differ, but not without the merger.

 TextMerge in BeyondCompare Pro

  • The 4-pane view shows left, base and right above as well as the target below, with the target window being editable. Each change has its own color, so you can see afterwards whether you took left, right or made manual changes.
  • The merge view includes a line-by-line differ that shows left, base, right and target lines directly above one another, with a scrollbar for longer lines.
  • The target view is color-coded to show the origin of each line of text: right, left, base or custom edited.
  • BeyondCompare makes a smart recommendation for how to merge a given conflict that is very often exactly what you want, which means that for many conflicts, you can just confirm the recommendation.
  • SmartGit has two separate windows for base vs. left/right and right/left vs. target. Long lines are really hard to decipher/merge in SmartGit

Integrate Beyond Compare into SmartGit

To set up SmartGit to use Beyond Compare

  1. Select Tools > Diff Tools
    1. Click the “Add…” button
    2. Set File Pattern to *
    3. Select “External diff tool”
    4. Set the command to C:\Program Files (x86)\Beyond Compare 4\BCompare.exe
    5. Set the arguments to “${leftFile}” “${rightFile}”
  2. Select Tools > Conflict Solvers
    1. Select “External Conflict Solver”
    2. Set File Pattern to *
    3. Set the command to C:\Program Files (x86)\Beyond Compare 4\BCompare.exe
    4. Set the arguments to “${leftFile}” “${rightFile}” “${baseFile}” “${mergedFile}”

Update March 11th, 2021

I was testing the Git support in Visual Studio Code and ran into a somewhat surprising limitation. For those that use IDE Git integration without an external tool, this would be a pretty disappointing message. What do you do then?

 VS Code Git overwhelmed


[2] I am in no way affiliated with SmartGit.
[3] I am in no way affiliated with BeyondCompare.