Shameless plug, but that's exactly the aim of https://github.com/MichaelMure/git-bug.
It's a distributed bug-tracker: it stores issues (and one day, PRs) within git. You can work offline and you always have a full copy of everything. It also has bridges for Github, Gitlab and Jira.