Git Common Command Learning notes

Source: Internet
Author: User
Tags commit

1. Installation:

$ sudo apt-get install git

$ sudo apt-get install gitk# This is an official graphical interface that does not need to be installed without

2, CD to the code to be managed, the file is located in the first level of directory

3. Initialization:

$ git init

4, add the current directory all content:

$ git Add.

5, view the status:

$ git status

6. Add Commit:

$ git Commit-am "a."

7, Version comparison:

$ git diff

8. View historical records:

$ git log

9. Branch operation

View Branch: $ git Branch

To create a branch: $ git Branch branch name (note: Do not set up branches on the service side)

Toggle Branch: $ git Checkout branch name

Delete Branch: $ git branch-d branch name

10. Join the server

$ git remote add user name @ computer name or ip:~/a directory

11. Push Data

$ git push master master #本地master推送到远端master

If you want to quickly use git push to 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 at remote path>

After you have done this, you will automatically push to the address above with git push, but if you want to push to another branch, you need to add parameters, this setting is just a default parameter.

12. Receive Data

$ Git pull Origin Master

If you want to directly receive with Git pull, you also need to make a one-time setting (again, you can't apply multiple branching pull):

$ git Branch--set-upstream Master origin/master

13, local library set personal name and mail

$ git config--global user.name "Your name is best made up of no matches and spaces in English letters"

$ git config--global user.email < mail name >@< mailbox service suffix >

If you do not set personal information, the submitted information will not have changed the information, which will increase the difficulty of project management.

14, start the graphical interface

$ gitk

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.