If you don't let the property, you won't necessarily escape CGT. Take a look at HS283 for information on the main residence and CGT. Examples 4 and 9 may be of interest to you. If you don't qualify for absence relief (see next paragraph) you should qualify for letting relief if you let the property.
If you move abroad to work, you may qualify for absence relief. If you do, then provided you occupied the property both before and after your return to the UK, the period of absence would be treated as a period of occupation by you even if the property is let during that period. Read the conditions here and from CG65030 to CG65050. Click on "Next Page" to move between pages.
If you let the property whilst abroad, you will have to register as a non-resident landlord. You can read about that here.
The gain on a property that has been your main home will be split between taxable and non-taxable parts. How much will be taxable and how much will be non-taxable depends entirely on how long you own the property, how long you live in it, how long you let it for, how much it cost and how much it is sold for. Nobody can say what tax rules may or may not exist in 2018 to 2020 or whether property prices will rise or fall. CGT on property gains is charged at 18% or 28% or a combination of the two rates depending on the level of your income in the tax year you sell it. Look here for information on CGT and here for information on property gains and CGT.
I cannot tell you exactly how you would be taxed in Germany on a property gain, what exemptions and reliefs you may be entitled to for example, so you would need to take local expert advice on that. Any taxable gain as computed for UK tax purposes would be charged to CGT in the UK but you would get credit for CGT paid in the UK against your German tax liability on the gain.
I hope this helps but let me know if you have any further questions.