Checked out master branch, made changes. How now to create a new branch, commit changes, and push it to the remote?
Push Branch to Another Branch In some cases, you may want to push your changes to another branch on the remote repository. In order to push your branch to another remote branch, use the “git push” command and specify the remote name, the name of your local branch as the name of the remote branch.
In order to clone a specific branch, you have to execute “git branch” with the “-b” and specify the branch you want to clone. $ git clone -b dev https://github.com/username/project.git Cloning into 'project'... remote: Enumerating objects: 813, done.
Four steps to get your changes committed locally and get them pushed to your server:
Create a local branch and commit to it
git checkout -b your-shiny-branch
git add .
git commit -m "Your Message"
Push your branch to your remote (server)
git push -u origin your-shiny-branch
If you then need to do further commits, start from command #2 and omit the -u
flag during the git push
on step #4.
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