The simplest thing to do, and the one that retains full credit to the original authors and history of the development of your file in context, is to fork the whole project on Github, clone it, delete all the files you don't need, and alter the ones you do. Nothing fancy, just your normal git rm, git add, and git commit. It's good to retain the full history because you and future maintainers can use git blame to discover why some lines are there for future bug hunting.
If the repository is particularly large, you can permanently delete all the other files from history using something like the BFG Repo Cleaner.
You'll also want to check the licensing. It is not legal in most parts of the world to copy and alter someone else's code, even if it's publicly available on Github, unless they grant you that privilege with a license. Check for a LICENSE file for the project, or a license statement within the file. If the project as a whole has a license file, but the individual file does not (very common these days) you probably need to mention that same license in your single file. The details depend on the license.
Note that the original author retains copyright. You are granted license to use and modify their work, if the license grants you that, but they retain copyright.