/    /  Git – push

Git Push 

 

git push” is a command in the Git version control system that is used to upload local changes to a remote repository.

  • In Git, you make changes to the code in your local repository and use “git push” to send those changes to a remote repository, where they can be shared with others. The “git push” command transfers the commits from your local repository to the remote repository and updates the remote branch with your changes.
  • The basic syntax for the “git push” command is as follows:
     git push <remote> <branch>
  • Where <remote> is the name of the remote repository you want to push to and <branch> is the name of the branch you want to push. For example, if you want to push your changes in the local “master” branch to the remote repository named “origin”, you would run: 
     git push origin master
  • When you run the “git push” command, Git checks if the remote branch has any new changes since you last fetched it. If there are no conflicts with the remote branch, your changes will be pushed to the remote repository. If there are conflicts, the push will fail, and you will need to resolve the conflicts before you can push your changes.
  • It’s important to note that “git push” can overwrite changes in the remote repository, so it’s important to use caution when using this command, especially if you’re working in a team. It’s a good practice to always pull the latest changes from the remote repository before pushing your changes to avoid conflicts.

The git push command in workflow of git comes after the git commit command. It runs as follows :

push

As shown above the git push origin master has pushed the changes made in the local repository to the remote repository.