If you work only for part of the year in Germany and are leaving Germany before the end of the tax year (the calendar year is the tax year) you have to file a tax return in Germany for this particular year irrespective of any other factors. As a rule of thumb you can get a refund if the level of income after your departure is lower than your German income. You can also expect a refund if you did not work for some time at all after you left. If your level of income increases after your departure it can cause you to have to pay extra in Germany.