1

I am trying to fork an existing project on Github and add some features to the existing code (for my own problem and perhaps unrelated to what the existing code intends to do).
I only need a single JS code from the forked project.
How am I supposed to do that?
How should I change the original author comment (heading) on that JS file?

I want the new comment to reflect that I am the new author, but it has originally created by someone else.

3
  • You cannot fork only one file. You have to fork the whole project, change the file you want and remove the rest if you don't need them... Commented Sep 10, 2016 at 13:07
  • 1
    And by the way it is a Git question not a Github related one just change the tag i think Commented Sep 10, 2016 at 13:07
  • @SaeedEntezari thanks for the title suggestion. In fact, it's not even completely a Git question. It's more regarding the ethics of using other people's codes. Commented Sep 11, 2016 at 9:21

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

How should I change the original author comment (heading) on that JS file?

If you are talking about the first lines of the files, you simply edit those, git add, git commit and push to your fork the modified file.

Note that the history of that file will still list the original maintainer as the one having created the file.

1 Comment

Short and to the point. Sorry, I can't set both answers as the accepted.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.