To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch).
To push the branch or you can say to push the changes in the branch to the Github repo you have to run this command “git push origin <the branch name>” in our case the branch name is “main”. After pushing the changes the repo will look like and this is how you can push a branch to a remotely hosted GitHub repository.
You need to use git pull and resolve the difference between your local changes and the remote changes before you can git push . There is still a commit in the remote branch initializing the repo that may not be in your local version.
We can push the head of a branch like below
$ git push origin HEAD
And, we can use @
for alias of HEAD
.
$ git show @
Then why does the below command gives me an error?
$ git push origin @
fatal: remote part of refspec is not a valid name in @
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With