gitgithubcommit

How can I upload committed changes to my GitHub repository?


I used clone to create a local copy of my repository on GitHub.

I modified a few files. Then I did: git commit -a

And now I want to save my committed changes to the GitHub repository.

How can I do that?


Solution

  • You push your changes:

    git push origin master
    

    Replace master with the name of the branch you want to push, if different from master.

    In case the branch was updated since your last update, the changes may be rejected. In that case you have to pull the latest changes on the remote branch first:

    git pull origin master
    

    Optionally, you can rebase your changes on top of the remote master (this will prevent a merge commit), by using:

    git pull origin master --rebase