I often rebase feature branches and then want to force push them to the server.
git push --force origin feature-mongodb-support
Is there any shortcut for git push --force origin <current branch>?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use aliases to shorten the command. Use it like this:
Now to push your branch just type:
Or you can even hardcode the branch name into the command:
and use only
git fpushto push your precious work into the upstream.However, non-fast-forward updates are dangerous since you will basically overwrite all the history on server that occurred between the last merge/rebase into your local branch and the forced push. If you need to do them often there is definitely something wrong in your workflow.