Git allows you to view local branches, create branches, upload branches, submit code to branches, and delete branches.

Source: Internet
Author: User

Git allows you to view local branches, create branches, upload branches, submit code to branches, and delete branches.
Git to view local and create branches and upload branches to the server

The command operations in the git command line are as follows:

Welcome to Git (version 1.9.5-preview20141217) Run 'git help git 'to display the help index. run 'git help <command> 'to display help for specific commands. # Go To The project directory giscafer @ LAOHOUBIN-PC/G/002_project $ cd Comments # view which giscafer @ LAOHOUBIN-PC/G/002_project/Comments (master) $ git branch-a doc * master remotes/origin/HEAD-> origin/master remotes/origin/doc remotes/origin/master # Check which local branches have giscafer @ LAOHOUBIN-PC/G/002_project/Comments (master) $ git branch doc * master # create local test branch giscafer @ LAOHOUBIN-PC/G/002_project/Comments (master) $ git branch test # view the local branch to see the test branch giscafer @ LAOHOUBIN-PC/G/002_project/Comments (master) $ git branch doc * master test # push local test branch to remote server giscafer @ LAOHOUBIN-PC/G/002_project/Comments (master) $ git push origin testUsername for 'https: // git.oschina.net ': giscaferP Assword for 'https: // giscafer@git.oschina.net ': Total 0 (delta 0), reused 0 (delta 0) to https://git.oschina.net/giscafer/Comments.git * [new branch] test-> test # Switch To the test branch giscafer @ LAOHOUBIN-PC/G/002_project/Comments (master) $ git checkout testSwitched to branch 'test' # add the local folder to be uploaded (git add file by adding code files. js) giscafer @ LAOHOUBIN-PC/G/002_project/Comments (test) $ git add db # submit information giscafer @ LAOHOUBIN-PC/ G/002_project/Comments (test) $ git commit-m' submit the data structure table design document to the test branch '[test 867e877] submit the data structure table design document to the test branch 1 file changed, 0 insertions (+), 0 deletions (-) create mode 100644 "db/\ 346 \ 225 \ 260 \ 346 \ 215 \ 256 \ 345 \ 272 \ 223 \ 350 \ 241 \ 250 \ 347 \ 273 \ 223 \ 346 \ 236 \ \ 204.docx "Warning: your console font probably doesn't support Unicode. if you experience strange characters in the output, consider switching to a TrueType font Such as Lucida Console! # The error message is reported when uploading to the remote server (because the -- set-upstream origin <branch name> is required for submitting to the Branch) giscafer @ LAOHOUBIN-PC/G/002_project/Comments (test) $ git pushfatal: The current branch test has no upstream branch. to push the current branch and set the remote as upstream, use git push -- set-upstream origin test # The following will be submitted to the remote server giscafer @ LAOHOUBIN-PC/G/002_project/Comments (test) $ git push -- set-upstream origin testUsername for 'https: // git.oschina.net ': giscaferPassword for' https: // giscafer@git.oschina.net ': Counting objects: 6, done. delta compression using up to 8 threads. compressing objects: 100% (4/4), done. writing objects: 100% (4/4), 14.90 KiB | 0 bytes/s, done. total 4 (delta 1), reused 0 (delta 0) To https://git.oschina.net/giscafer/Comments.git a7e5547 .. 867e877 test-> testBranch test set up to track remote branch test from origin.
# Delete the local branch (error prompted because the test branch was used at the beginning) giscafer @ LAOHOUBIN-PC/G/002_project/Comments (test) $ git branch-d testerror: cannot delete the branch 'test' which you are currently on. # switch to another branch giscafer @ LAOHOUBIN-PC/G/002_project/Comments (test) $ git checkout docSwitched to branch 'doc 'Your branch is up-to-date with 'origin/doc '. # Delete giscafer @ LAOHOUBIN-PC/G/002_project/Comments (doc) $ git branch-d testwarning: deleting branch 'test' that has been merged to 'refs/remotes/origin/test', but not yet merged to HEAD. deleted branch test (was 867e877 ). giscafer @ LAOHOUBIN-PC/G/002_project/Comments (doc) $ git branch * doc master
# View the current origin $ git remote-vorigin https://git.oschina.net/giscafer/Comments.git (fetch) origin https://git.oschina.net/giscafer/Comments.git (push)
# Delete remote branch giscafer @ LAOHOUBIN-PC/G/002_project/Comments (doc) $ git push origin: testUsername for 'https: // git.oschina.net ': giscaferPassword for 'https: // giscafer@git.oschina.net ': To https://git.oschina.net/giscafer/Comments.git-[deleted] test

END

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.