Where to connect GND on keyboard multiplexer circuit?
in the comment section, you have said that you are using Arduino. Common Arduino uses AVR microcontroller. The picture I have included above is from the datasheet of ATMEGA16. The GPIO pins you see externally are connected to this type of logic circuit internally.  

The I/O pins are controlled by mainly two registers. One is called the Data Direction Register, and another is the PORT Register. The red marked block represents DDR bit. If it is set to 1, the tristate buffer (green circle) will be turned on, and the value of the PORT register (blue box) will appear at your external pin.   

Any value of the external pin is stored in the PIN Register. If the DDR bit is 0 then the buffer will be turned off. And if the pull-up system is disabled too, your pin would be in a floating state. If an external input comes, then it can't pass through the buffer and can't cause a short circuit with the PORT Register bit. It goes toward the transmission gate and the synchronizer circuit and its state i.e. 1/0 is stored in the PIN register. 

All you have to do is giving a logic 1 to one line (i.e. DDR bit = 1 &amp; PORT bit =1) and declare other bits as input( i.e. DDR bit 0). Then check the value of the PORT register. 

In Arduino, Data Direction Registers are controlled by ' pinMode(); ' function.
PORT Registers are controlled by '  digitalWrite(); ' function.
PIN Register values are checked by '  digitalRead().; ' function. 

  

The red lines represent a switch press event. I guess you have understood why the diodes and the ground connection are unnecessary.