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