GIT branch Management

Source: Internet
Author: User

Create a branch

Git branch <local_branch_name>

Create and switch to a new branch

Git checkout-b <local_branch_name>

Switch branches

git checkout <local_branch_name>

Merging branches

git merge <local_branch_name>

Merge is a merge of two branches, if you want to merge b_branch into the A_branch,

The actual operation is to switch to A_branch first and then execute merge on A_branch.

git checkout <A_branch>

git merge <B_branch>

?

Conflicts must be resolved if a conflict occurs in the merge.

Git conflict resolution:

。。。。。。。

。。。。。。

。。。。。

。。。。

。。。

?

?

git status

Git commit

git push

Git push Origin <local_branch_name>:<remote_branch_name>

?

git Delete Branch

Git branch-d <local_barnch_name>

Git branch-d <local_banrch_name>

Git branch Rename

git branch-m <old_branch_name> <new_branch_name>

Git to see the branches that have been merged

Git branch-merged

Git view non-merged branches

Git branch?--no-merged

?

Git rebase

Rebase is actually a patch that hits the current branch on the specified branch, and finally the current branch is combined with the specified branch. The difference between this and merge is that the current branch merges with the specified branch and produces a new commit, making the entire Git project look neater, while the merge retains all the branch commit records.

You can see that git rebase is similar to git merge. And the conflict that is going to arise

Conflict resolution, see above.


?

GIT branch Management

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.