In this tutorial, you will understand how to git push the local changes using the -u origin master command.

Before getting started, I just need to explain what push is and how to save the local changes as the master.

Let’s see, what is git?

Git Push Overview

Git is a repository for tracking all project source code updates and changes. It helps project managers to store and track all changes with commits, so they can go back to any change that already happened before.

Actually, the git push command is referring to pushing the local changes to the remote branch. But to do that, you have to specify the branch name. In the following few lines I have to explain what are origin and master words.

Anyway, the master word is referring to the default branch name of the repository, and you can change the branch name to whatever through this article the (git branch).

But the origin word means the original repository, which is the main repository.

Once you commit your local changes, you have to use the following command to upload these changes into the remote repository.

git push origin master

What Does Mean Git Push -u Origin Master

As I mentioned before regarding git push origin master. But the -u flag refers to update the tracked file, which is referring to --update word.

In the following code, you will see how does it work?

git push -u origin master

Once you run it, will track the file to the tree. In the following image shows you how it works.

git push -u origin master

Conclusion

On this article, you learned how to use the git push command to upload the latest changes of the local branch.

Also, you learned how to change the current branch name to another one.

And learned the difference between the origin word and the master word.