Introduction to git Installation and usage on Linux unzip and switch to its directory $ tar xvfj git-1.7.6.tar.bz2$ cd git-1.7.6install using the default configuration, if you want to modify the configuration, you can use the./configure--help to get assistance $./configure$ make$ make install2, initialize configuration git is installed by default in/usr/local/bin, after installation, you can verify that the $ Whereis gitgit is installed.:/usr/local/bin/git$ git--versiongit version1.7.6$ git--Help first needs to specify user name and email address $ git config--GlobalUser.name "git Admin" $ git config--GlobalUser.emal [email protected]com re-verify configuration information www.2cto.com $ git config--ListUser. name=GIT Adminuser[Email protected]Comcore. repositoryformatversion=0Core. filemode=trueCore. bare=falseCore. logallrefupdates=trueIn fact, these configurations are stored in the personal home directory.gitconfig files in the $ cat~/.Gitconfig[user]name=GIT AdminEmail= [email protected]com3, any directory that establishes the local storage for the project can build a git project if an existing project is located in/home/obugs/projects/orangebugs directory, you can define this directory as a git project $ cd/home/obugs/projects/orangebugs$ git initinitializedEmptyGit Repository in/home/obugs/projects/orangebugs/.git/This establishes a name for the.git folder, which is the folder that Git uses to store information and track changes. www.2cto.com $ ls-altr.Gittotal40DRWXRWXR-x 4 git git 4096 13 22:39REFSDRWXRWXR-x 4 git git 4096 13 22:39OBJECTSDRWXRWXR-X 2 git git 4096 13 22:39INFODRWXRWXR-X 2 git git 4096 13 22:39Hooks-rw-rw-r--1 git git 13 22:39HEAD-rw-rw-r--1 git git 13 22:39Description-rw-rw-r--1 git git 13 22:39CONFIGDRWXRWXR-X 2 git git 4096 13 22:39BRANCHESDRWXRWXR-X, git git 4096 13 22:39.DRWXRWXR-X 7 git git 4096 13 22:39. 4, add and submit files to your project these actions and CVS, SVN, and so on are similar to git add*.java *.C $ git commit-m ' Initial upload of the project ' Create mode100755 orangebugs.javacreate Mode100755 Pwm/ui/datamanager.javacreate Mode100755 Pwm/ui/passwordframe.javacreate Mode100755 pwm/tools/strongencryption.javacreate Mode100755 Pwm/tools/passwordstrength.Java..Note If you have not previously specified a user name and email address using git config, you will get an error $ git commit-M ' Initial upload of the project ' Please tell me who is you. www.2cto.com Run git config--global user.email "[email protected]" git config--global user.name "Your name" to SE T your account ' s default identity. Omit--global to set the identity of the This repository. Fatal:empty ident not allowed 5, change files and commit changes to edit files, add or remove some fields $ vi Orangebugs.java view and files in Git repository compared to those that were changed $ git diffdiff--git A/orangebugs.java B/orangebugs.javaindex 6166ed1. Fd82d32 100644-a/orangebugs.java+++ b/orangebugs.java@@ -2,7 +2,7 @@-public counter=10+ public counter=55 if you want to submit, you need to ensure that the text The staging area can then be submitted, the default editor of the system will open automatically when submitted, and when the user adds some comments to save and exit the editor, the comments are submitted to the repository at the same time. www.2cto.com $ git add orangebugs.java$ git commit[master 80f10a9] Added password strength meter functionality1 files changed, insertions (+), 7 deletions (-) or, the simple way is to use Git commit-a to combine the above two commands. 6. View status and view comments if there are no changes to the local file compared to the files on the remote Git repository, the $ git status# on branch masternothing to commit (working directory clean) If local changes are made But no commit, then $ git status# on branch master# changesNot staged for commit:# (use "git add ..." To update what'll be committed) # (use "Git checkout-..." to discard changes in Working directory) # # Modified:orangebugs.java#no changes added to commit (using "git add" and/or "Git commit-a") In addition, you can use the following command to view file history and previous comments $ git log orangebugs.javacommit c919ced7f42f4bc06d563c1a1eaa107f2b2420d5author:git Admin www.2cto.com D Ate:sat 22:54:57 2011-0700 Added password strength meter functionality commit c141b7bdbff429de35e36bafb2e43edc655 E9957author:git admindate:sat 20:08:02 2011-0700 Initial upload of the project