Skip to content

Instantly share code, notes, and snippets.

@MarcDiethelm
Last active January 14, 2024 02:05
Star You must be signed in to star a gist
Save MarcDiethelm/7303312 to your computer and use it in GitHub Desktop.
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.

How to make a clean pull request

Look for a project's contribution instructions. If there are any, follow them.

  • Create a personal fork of the project on Github.
  • Clone the fork on your local machine. Your remote repo on Github is called origin.
  • Add the original repository as a remote called upstream.
  • If you created your fork a while ago be sure to pull upstream changes into your local repository.
  • Create a new branch to work on! Branch from develop if it exists, else from master.
  • Implement/fix your feature, comment your code.
  • Follow the code style of the project, including indentation.
  • If the project has tests run them!
  • Write or adapt tests as needed.
  • Add or change the documentation as needed.
  • Squash your commits into a single commit with git's interactive rebase. Create a new branch if necessary.
  • Push your branch to your fork on Github, the remote origin.
  • From your fork open a pull request in the correct branch. Target the project's develop branch if there is one, else go for master!
  • ...
  • Once the pull request is approved and merged you can pull the changes from upstream to your local repo and delete your extra branch(es).

And last but not least: Always write your commit messages in the present tense. Your commit message should describe what the commit, when applied, does to the code – not what you did to the code.

@8xu
Copy link

8xu commented Oct 18, 2021

This is helpful! <3

@talib1996
Copy link

Thanks a lot. Very Helpful

@dozykeys
Copy link

Very insightful

@f4b3r
Copy link

f4b3r commented Nov 10, 2021

thank you. so helpful!

@smaster0517
Copy link

Good!
Wonderful!
Hope to see the further articles.

@alphainfinitus
Copy link

Thank you kind sir!

@shemake
Copy link

shemake commented Dec 30, 2021

This was extremely helpful. Thank you for the writeup!

@dagnu11
Copy link

dagnu11 commented Jan 5, 2022

Very Helpful

@lexNwimue
Copy link

Extremely helpful but could have used some actual examples. Some new users may not even know how to set upstream

Copy link

ghost commented May 31, 2022

I don't want to use since I do not want to use git techniques or github. Is there any way I could contribute without commands?

@lexNwimue
Copy link

I don't want to use since I do not want to use git techniques or github. Is there any way I could contribute without commands?

I don't think that's advisable but I guess there must be GUI git tools

@silas315
Copy link

thanks for this

@JonEckenrode
Copy link

Good instructions. Thanks.

@TOGUNOLUWATOBI
Copy link

Very Helpful. Thanks

@idontcalculate
Copy link

Thanks!

@LEG1ON-Group
Copy link

I connected, but I don't know how to control it. When I write "open (numbers)" up, it says "Invalid Selection."

@kururu-abdo
Copy link

would be great if you add an example for every step

@kururu-abdo
Copy link

  1. fork the repo you want to contribute to

  2. clone the forked repo
    git clone github/your-user/liked-to-forked-repo

  3. open terminal into repo directory in your local machine
    cd repoName

  4. check you remote origin
    git remote -v

  5. add your forked repo as origin and add the original repository link as upstream

git remote add origin url-to-forked-repo

git remote add upstream url-to-original-repo.

and check the two remotes again with git remote -v

  1. Create a new branch
    git checkout -b BRANCH_NAME

  2. commit and push to your branch
    git push origin BRANCH_NAME

  3. go to forked repo to and you will see pull requests button click on it to begin pull to the original repo

  4. Create the pull request
    lastly , go to the original repo and complete pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment