I want to push a branch (not the current) without having to check it out first, how can I achieve that ?
this is how I'd do:
#currently in master git checkout feature git push origin feature git checkout master
but checking out feature can cause conflicts, can't I just push another branch than the current one ?
The "push" command is used to publish new local commits on a remote server. The source (i.e. which branch the data should be uploaded from) is always the currently checked out HEAD branch. The target (i.e. which branch the data should be uploaded to) can be specified in the command's options.
What happens if I push the way it is? If you git push , it will simply re-create the old branch name on the remote. If you hadn't renamed your branch this would likely be fine assuming you intended to re-use the same branch name, but since you renamed your branch, this is undesirable.
Simply:
git push origin feature:feature
Or shorter:
git push origin feature
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