Git's initial use & amp; Git common command query & amp; Git push & amp; Git pull

Source: Internet
Author: User

Git's first use & Git common command query & Git push & Git pull before introducing installation and simple use, let's take a look at The introduction in Baidu Encyclopedia: ---------------------------------- Git --- The stupid content tracker, dummies content tracker. In Linux, we will introduce Git: Git is a version control tool for Linux kernel development. Unlike common version control tools such as CVS and Subversion, it uses a distributed version library without the support of the server software, making it extremely convenient to publish and exchange source code. Git is fast, which is naturally important for large projects such as Linux kernel. Git's most outstanding is its merge tracing capability. Www.2cto.com ---------------------------------------- below I use the commands on ubuntu 10.10 as an example: (these commands are used at the local client and used for non-server operations in the bare Library) (In this article, the angle brackets contain the description content. Replace the description content with the actual description content when you enter the actual command .) 1. Installation: $ sudo apt-get install git $ sudo apt-get install gitk # This is the official graphic interface for installation, do not install unnecessary. 2. Run cd to the Code to be managed, the first-level directory where the file is located. 3. initialize: www.2cto.com $ git init 4. Add all content in the current directory: $ git add. 5. view the status: $ git status 6. Add commit: $ git commit-am "first commit. "7. version comparison: $ git diff 8. view history: $ git log 9. View branch operations: $ git branch create branch: $ git branch name (note: do not create a branch on the server) Switch branch: $ git checkout branch name www.2cto.com Delete branch: $ git branch-d branch name 10 Add the username @ computer name or IP address to the server $ git remote add :~ /A directory 11, push data $ git push master # local master push to the remote master if you want to quickly use git push to the default remote branch master, you can make a one-time setting: $ git remote add origin <actual ssl user name >@< IP address >:< Git's remote path> after completing the preceding settings, in the future, direct use of git push will be automatically pushed to the above setting address. However, if you want to push to other branches, you still need to add parameters. This setting is only equivalent to a default parameter. 12. receive data $ git pull origin master if you want to directly use git pull to receive data directly, you also need to make a one-time setting in advance (also cannot apply multiple branch pull ): www.2cto.com $ git branch -- set-upstream master origin/master 13. set the personal name and email for the local database $ git config -- global user. name "Your name, preferably composed of letters with no matching or spaces" $ git config -- global user. email <email Name> @ <email service provider suffix> if you do not set personal information, the submitted information will not have changed information, which will increase the difficulty of project management. 14. Start the graphic interface $ gitk author mvp_xuan

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.