Search code examples
gitgithubgit-push

How to push my changes back to the source code in git


I forked a project in github and then did a git clone on this project to get all the source code to my machine.

I have made some modifications to the source code and my questions are:-

  1. How to commit my changes to the local git repository as well as my forked repository in github?
  2. How will the author of the original source code, pull my changes from the forked repository in github

Solution

    1. How to commit my changes to the local git repository as well as my forked repository in github?

    To add files changes for commit, use the following command.

    git add .
    

    then, make a local commit by

    git commit
    

    once you make your local commit, you can then push it to your remote GitHub fork.

    git push
    
    1. How will the author of the original source code, pull my changes from the forked repository in github

    To make your source code pulled by original fork, you have to send a pull request to the project owner.

    1. Go to the web page of your forked project on GitHub.
    2. Hit the pull request button on the top right of page
    3. Select the commits that you want to submit by change commits button.
    4. Write some description of your changes, comments, or etc.
    5. Send pull request and wait for the owner reply.