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

Source: Internet
Author: User

Git view local and create branches and upload branch to server

Here is the command operation in the GIT command line, plus the instructions:

Welcome to Git (version1.9. 5-preview20141217) Run' git help git 'To display the Help index. Run' git help <command> 'To display Help forSpecific commands.# #进入项目目录下Giscafer@LAOHOUBIN-pc/g/002_project$ CD Comments# #查看远程分支有哪些Giscafer@LAOHOUBIN-pc/g/002_project/comments (Master) $ git branch-a doc* master Remotes/origin/head -Origin/master Remotes/origin/doc Remotes/origin/master# #查看本地分支有哪些Giscafer@LAOHOUBIN-pc/g/002_project/comments (master) $ git branch doc* Master# #创建本地test分支Giscafer@LAOHOUBIN-pc/g/002_project/comments (master) $ git branch test# #查看本地分支即可见到多了test分支Giscafer@LAOHOUBIN-pc/g/002_project/comments (master) $ git branch doc* Master test# #将本地test分支推送到远程服务器Giscafer@LAOHOUBIN-pc/g/002_project/comments (Master) $ Git push origin Testusername for ' Https://git.oschina.net ': Giscaferpassword for ' https://[email protected] ': Total0(Delta0), reused0(Delta0) toHTTPS://giT.oschina.net/giscafer/comments.git * [NewBranch] Test -Test# #切换到test分支Giscafer@LAOHOUBIN-pc/g/002_project/comments (Master) $ git checkout testswitched to branch' Test '# #添加本地需要上传的文件夹 (code file Add way git add file. js)Giscafer@LAOHOUBIN-pc/g/002_project/comments (test) $ git add db# #提交信息Giscafer@LAOHOUBIN-pc/g/002_project/comments (test) $ git commit-m' Submit data structure table design document to test branch '[Test867e877] Submit the Data structure table design document to the test branch1File changed,0Insertions (+),0Deletions (-) Create mode100644 "Db/\346\225\260\346\215\256\345\272\223\350\241\250\347\273\223\346\236\204.docx"Warning: YourConsoleFont probably doesn' t support Unicode. If You experience strange characters in the output, consider switching to a TrueType font such as Lucida console!# #上传到远程服务 The bottom of the device is the error message (because the submission to the branch needs to give--set-upstream origin < branch name >) [email protected]/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# #如下将提交推送到远程服务器 [email Protected]/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.
# #删除本地分支 (error is prompted because the test branch was originally used)[Email protected]/g/002_project/comments (test) $ git branch-d testerror:cannotDelete  theBranch' Test 'which you is currentlyOn  .# #切换到其他分支[Email protected]/g/002_project/comments (test) $ git checkout docswitched toBranch' Doc 'Your Branch is up- to-Date  with ' Origin/doc '.# #再次删除即可[Email protected]/g/002_project/comments (DOC) $ git branch-d testwarning:deleting Branch' Test 'That has been merged to         ' Refs/remotes/origin/test ', but notYet merged toHEAD. Deleted Branch Test (was867e877). [Email protected]/g/002_project/comments (DOC) $ git branch* doc Master
# #查看当前的origin  $ git Remote-vorigin https://git.oschina  .net /giscafer/comments.git  (Fetch) Origin Https://git.oschina  .net /giscafer/comments.git  (push )  
##删除远程的分支[email protected] /G/002for‘https://git.oschina.net‘for‘https://[email protected]‘:To https://git.oschina.net/giscafer/Comments.git - [deleted]         test

END

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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

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.