Git branch admin push local branch to remote branch etc __git

Source: Internet
Author: User

1. Create local branch Local_branch

Git branch Local_branch


2. Create local branch Local_branch and switch to Local_branch branch

Git checkout-b local_branch


3. Switch to Branch Local_branch

git checkout Local_branch


4, push local branch local_branch to remote branch Remote_branch and establish association relationship

A. Remote already has a Remote_branch branch and has associated local branch Local_branch and has switched locally to Local_branch

git push

B. Remote already remote_branch branch but not associated with local branch Local_branch and Local has switched to Local_branch

Git push-u origin/remote_branch

C. Remote does not have Remote_branch branch and, Local has switched to Local_branch

Git push Origin Local_branch:remote_branch

5. Delete local branch Local_branch

Git branch-d local_branch

6. Delete Remote Branch Remote_branch

git push origin:remote_branch

Git branch-m | -M oldbranch newbranch Rename branch, if newbranch name branch already exists, you need to force rename using-M, otherwise, use-M to rename.

Git branch-d | -D branchname Delete Branchname Branch

Git branch-d-R branchname Remove remote Branchname Branch


7. View local Branch

Git branch


8. View remote and local branches

Git branch-a


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.