Search code examples
gitversion-controlbitbucketcommit

Push locally committed changes to new branch


I am currently in master branch, I have committed the changes (locally) and tried to push it but it got rejected because I don't have access to push to master branch. Now I have created another branch dev where I have the permission to push.

Since I have already committed locally to master branch, how do I push these committed changes of master to dev branch?


Solution

  • Assuming your remote is named origin,

    git push origin master:dev
    

    would achieve it by explicitly giving source and destination. See it explained in this paragraph.

    This can be run from any branch as it's not using current branch for anything.