Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I omit <remote> and <ref> in 'git push'?

Tags:

git

When I'm on master, I only have to type 'git push' to push commits to the remote repo. I wish I could do so when I'm on another branch, without specifying the remote name and the branch name. Like that:

Now: git push origin experimental:origin/experimental

Need: git push

like image 500
snitko Avatar asked Dec 07 '08 02:12

snitko


People also ask

Does git push overwrite remote?

Warning: force pushing will overwrite the remote branch with the state of the branch that you're pushing. Make sure that this is what you really want to do before you use it, otherwise you may overwrite commits that you actually want to keep.

Can not push ref to remote?

The Error Message The error: failed to push some refs to remote git error occurs when new changes are pushed to the repository on version control not yet made it to your local repository. This could happen when you are working with someone on one project and simultaneously push to a branch.

Does git push push to all remotes?

The objective is to push to multiple Git remotes with a single git push command. If you don't want to create an extra remote named all , you can skip the first command and use the remote origin instead of all in the subsequent command(s). Now, you can push to all remote repositories with a single command!


1 Answers

You should edit your .git/config file. There should be already set something like this:

[branch "master"]
    remote = origin
    merge = refs/heads/master

Simply copy the group and edit according to your needs. For example, you could have:

[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "experimental"]
    remote = origin
    merge = refs/heads/experimental
like image 177
Damir Zekić Avatar answered Sep 29 '22 18:09

Damir Zekić