YouTip LogoYouTip

Git Push

# git push Command [![Image 4: Git Basic Operations](#)Git Basic Operations](#) * * * The **git push** command is used to upload local branch versions to a remote repository and merge them. The command format is as follows: git push : If the local branch name and the remote branch name are the same, the colon can be omitted: git push ### Example The following command pushes the local master branch to the master branch of the origin remote. $ git push origin master This is equivalent to: $ git push origin master:master If there is a difference between the local and remote versions, but you want to force the push, you can use the --force parameter: git push --force origin master To delete a branch on the remote, you can use the --delete parameter. The following command deletes the master branch on the origin remote: git push origin --delete master Using my [ as an example, adding a file locally: $ touch -test.txt # Add file $ git add -test.txt $ git commit -m "Add to remote" master 69e702d] Add to remote 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 -test.txt $ git push origin master # Push to Github This pushes the local master branch to the master branch of the origin remote. Returning to our Github repository, we can see the file has been committed: !(#) * * Git Basic Operations](#)
← Cpp Examples Data TypesPython3 String Rfind β†’