Using Visual Studio Code as Git merge tool

Visual Studio Code is a neat editor with many good functionalities but I especially like the way it shows Git merge conflicts. Instead of a 2-way or a 3-way split it just shows one window with both changes, nicely highlighted with colors and actions.

I like this feature so much I decided to set Visual Studio Code as my Git merge tool for both the command line and Git Tower.

Command line

Using Visual Studio Code as a merge tool for Git when using command line means editing your .gitconfig. You just need to define a new tool called code and set it as the default merge tool.

        tool = vscode
[mergetool "vscode"]
        cmd = code --wait $MERGED
[Read More]
Git  macOS  VSCode 

Quick Tip: Showing solution branch name in Visual Studio title

By default, Visual Studio shows the name of the opened solution name in the title. This makes it easier to navigate among multiple instances of Visual Studio. You see the solution name next to the Visual Studio icon in the taskbar and also in the task manager, when you have to (and we all sometimes have to) kill the right Visual Studio because it stopped responding.

I work with Git, switching branches frequently, especially working on features and bug fixes. In this situation, it would be nice if Visual Studio showed not only the solution name but also the current branch in its title. No problem, there is an extension for that.

The extension is called Rename Visual Studio Window and it works with Visual Studio 2015, 2013, 2012, 2010. This extension supports Git, so you can easily add the branch name to the title with a config like mine using [gitBranchName].

[Read More]

Automatically push your Git repos before computer shutdown

I use two computers, my desktop computer located at home and set up for work and play and a work notebook (company provided) that I usually leave at the office. I use both computers for work and sometimes I forget to do ‘git push’ when working at my home desktop computer. The next day, when using the work notebook, I wonder where the code from the previous day has disappeared.

Of course, I can solve it by connecting to my home Raspberry Pi through SSH, waking the desktop computer over LAN from it, connecting to it using Remote Desktop to do the ‘git push’ .. not really a simple solution, there must be a better way.

[Read More]