Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git push -f vs. +

Tags:

git

What is the difference between doing:

 git push -f origin my-branch:my-branch

and

 git push origin +my-branch:my-branch

?

like image 835
Johan Avatar asked Sep 18 '10 09:09

Johan


People also ask

What is pull vs push git?

git pull is one of many commands that claim the responsibility of 'syncing' remote content. The git remote command is used to specify what remote endpoints the syncing commands will operate on. The git push command is used to upload content to a remote repository.

What is git push vs git push origin?

Simply, we can say that git push command updates the remote repository with local commits. And origin represents a remote name where the user wants to push the changes.

When should I use git push?

git push is most commonly used to publish an upload local changes to a central repository. After a local repository has been modified a push is executed to share the modifications with remote team members.

What is a pull request vs push?

A "pull request" is you requesting the target repository to please grab your changes. A "push request" would be the target repository requesting you to push your changes.


1 Answers

Those are two syntaxes for the same goal.

Except that git push --force can be used when you don't specify any refspec (meaning you want to push your current branch to a remote matching name branch).
It is easier than:

git push origin +yourBranch

, as mentioned in the Git Community Book.

See "Why “git push helloworld +master:master” instead of just “git push helloworld”?" for illustration.

like image 77
VonC Avatar answered Sep 24 '22 08:09

VonC