GIT Branch Branch development

Source: Internet
Author: User

zhanhailiang 日期:2015-01-06

View Current Branch List

    [[Email protected]~/wade/git/billfeller.github.io]# git branch     gh-pages    * Master

New Branch

    [[Email protected]~/wade/git/billfeller.github.io]# git branch dev

Switch branches

    [[Email protected]~/wade/git/billfeller.github.io]# git checkout dev '     Dev'

Switch to New branch

    [[Email protected]~/wade/git/billfeller.github.io]# git checkout-b dev2    'dev2'

Add information from the submitted file to the index library

    test. Log

Adds all modified file information from the current file to the index library

    .

File submissions will be made according to the contents of the index Library

    'test'    test     0 files changed, 0 insertions (+), 0 deletions (-)     test . Log

See the difference between commits

    [[Email protected]~/wade/git/billfeller.github.io]# git diff

Merge other branches into the current branch

    [Email protected]~/wade/git/billfeller.github.io]# git merge dev2    Updating d509c69. Ce310ee    Fast-forward     0 files changed, 0 insertions (+), 0 deletions (-)     test. Log

Push the branch to the remote branch

 [[email protected]~/wade/git/billfeller.github.io]# Git push Origin dev2 Co    Unting objects:4, done .    Compressing objects:100% (2/2), done .    Writing objects:100% (3/3), 260 bytes, done . Total 3 (Delta 1), reused 0 (Delta 0) to [email protected]:billfeller/billfeller.github.io.git *  [New branch] Dev2->
     Dev2 

viewing remote branches

    [[Email protected]~/wade/git/billfeller.github.io]# git branch-r      origin/head-> origin/master      Origin/dev2      Origin/master

View local and remote branches

    [[Email protected]~/wade/git/billfeller.github.io]# git branch-a      dev    * dev2      gh-pages      Master      remotes/origin/head-> origin/master      remotes/origin/dev2      remotes/origin/master

Modify Branch Name

    [Email protected]~/wade/git/billfeller.github.io]# git branch-m dev mdev [    email protected]~/wade/git/ billfeller.github.io]# git branch-a    * dev2      gh-pages      master      mdev      Remotes/origin/head- > origin/master      remotes/origin/dev2      remotes/origin/master

Delete Remote Branch

 [[email protected]~/wade/git/billfeller.github.io]# git push Origin-- Delete Dev2 to [email protected]:billfeller/billfeller.github.io.git-[deleted] Dev2 [[email  protected]~/wade/git/billfeller.github.io]# git branch-a *  Dev2 gh-pages Master Mdev remotes/origin/head-> Origin/master Remotes/origin/master 

Reference article:
1. Git Getting Started Guide 11: Git branch Branch and merge branch
2. Git remote branch and refs file detailed
3. Git first experience (c) Git branch

GIT Branch Branch development

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.