WAY 1: (I prefer this way, no ability to lose uncommitted data)
Find commit id with: git reflog
List files from commit git diff-tree --no-commit-id --name-only -r <commitHash>
Example:
git diff-tree --no-commit-id --name-only -r d2f9ba4
d2f9ba4
is commit id from step 1.
Open required file with following command:
git show <commitHash>:/path/to/file
Example:
git show d2f9ba4:Src/Ext/MoreSwiftUI/ListCustom.swift
Src/...
is file path from step 2.
WAY 2: (Ability to lose uncommitted data)
Find commit id with: git reflog
Make hard reset to this commit: git reset --hard %commit ID%
Example:
git reset --hard c14809fa
Make necessary changes and do a new commit into required branch