Short answer

Yes, you can exit G-sec investments before maturity by selling them on the exchange like stocks.

Things to keep in mind