GIT is a distributed version control software created by LinusBenedictTorvalds to manage Linux kernel development more effectively, unlike common version control tools such as CVS and Subversion, it does not have to be supported by server software...
GIT is a distributed version control software created by Linus Benedict Torvalds to manage Linux kernel development more effectively, unlike common version control tools such as CVS and Subversion, it does not have to be supported by server software, and the speed and efficiency are also greatly improved. If www.2cto.com has the background of CVS or SVN, the more familiar method is the client-server mode. all the file repositories are stored on the server, you need to obtain the old version from the project on the server on the local installation client and submit the new version. GIT has abandoned this mode. when a user downloads a project from a remote GIT repository, all files of the project, including version history and file changes, will be downloaded, at this time, the local GIT becomes a server, and all the Commits (check-in) and commits (check-out) will be executed on this local server. after you confirm a change, it can be combined and synchronized with the remote warehouse (merge ). Therefore, the installation and configuration steps of GIT are the same on both the local machine and the server. Here, we will briefly introduce how to install and use GIT on Linux. In addition, GIT has a Windows client. 1. download and install GIT from here http://git-scm.com/download Download GIT or use the wget command to get $ cd $ wget http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2 If the above addresses cannot be downloaded, go http://download.csdn.net/detail/lovejuan007/3713236 Download and unzip it and switch to its directory www.2cto.com $ tar xvfj git-1.7.6.tar.bz2 $ cd git-1.7.6 to use the default configuration for installation, if you want to modify the configuration, you can use. /configure -- help to get help $. /configure $ make install 2. the initial configuration GIT is installed in/usr/local/bin by default. after installation, you can verify whether the installation is successful. $ whereis gitgit: /usr/local/bin/git $ git -- versiongit version 1.7.6 $ git -- help first you need to specify the user name and email address $ git config -- global user. name "GIT Admin" $ git config -- global user. emal obugs.net@gmail.com re-verify the configuration letter Www.2cto.com $ git config -- listuser. name = GIT Adminuser. email = obugs.net@gmail.comcore.repositoryformatversion = 0core. filemode = truecore. bare = falsecore. logallrefupdates = true in fact, these configurations are stored in the home directory. $ cat ~ in the gitconfig file ~ /. Gitconfig [user] name = GIT Adminemail = obugs.net@gmail.com 3. you can create a GIT project in any directory where the project is locally stored. if the current project is located in the/home/obugs/projects/orangebugs Directory, you can define this directory as a GIT project $ cd/home/obugs/projects/orangebugs $ git initInitialized empty Git repository in/home/obugs/projects/orangebugs /. git/creates a file named. git folder, which is the folder that GIT uses to store information and track changes. Www.2cto.com $ ls-altr. gittotal quota 4 git 4096 Aug 13 refsdrwxrwxr-x 4 git 4096 Aug 13 objectsdrwxrwxr-x 2 git 4096 Aug 13 infodrwxrwxr-x 2 git 4096 Aug 13 hooks -rw-r -- 1 git 23 Aug 13 HEAD-rw-r -- 1 git 73 Aug 13 description-rw-r -- 1 git 92 Aug 13 configdrwxrwxr-x 2 git 4096 Aug 13 branchesdrwxrw Xr-x 36 git 4096 Aug 13 .. drwxrwxr-x 7 git 4096 Aug 13. 4. add and submit files to the project. these operations are similar to those of CVS and SVN, such as $ git add *. java *. c $ git commit-m'initial upload of the project 'create mode 100755 Orangebugs. javacreate mode 100755 pwm/ui/DataManager. javacreate mode 100755 pwm/ui/PasswordFrame. javacreate mode 100755 pwm/tools/StrongEncryption. javacreate mode 100755 pwm/tools/PasswordStrength. java .. note: If you have not used git config to specify the user name and email address, the error $ git commit-M' Initial upload of the project *** Please tell me who you are. www.2cto.com Run git config -- global user. email "you@example.com" git config -- global user. name "Your Name" to set your account's default identity. omit -- global to set the identity only in this repository. fatal: empty ident not allowed 5. modify the file and submit the modified editing file. some fields are added or deleted. java View the changes compared to the files in the GIT repository $ git diffdiff -- git a/Orangebugs. java B/Orangebugs. javaindex 6166ed1 .. fd82d32 100644-a/Orangebugs. java ++ B/Orangebugs. java @-+ @-public counter = 10 + public counter = 55 if you want to submit the file, make sure that the file is added to the temporary area before submission, the default editor of the system is automatically opened when the system is submitted. when you add comments and save them and exit the editor, these comments are submitted to the repository at the same time for www.2cto.com $ git add Orangebugs. java $ git commit [master 80f10a9] Added password strength meter funct Ionality1 files changed, 56 insertions (+), 7 deletions (-) or, simply use git commit-a to merge the preceding two commands into one. 6. View status and view comments. if the local file is not changed compared with the file in the remote GIT repository, $ git status # On branch masternothing to commit (working directory clean) if a local change is made but not submitted, $ git status # On branch master # Changes not staged for commit: # (use "git add ..." To update what will be committed) # (use "git checkout -..." To discard changes in working directory) # modified: Orangebugs. java # no changes added to commit (use "git add" and/or "git commit-a") in addition, you can use the following command to view the file history and previous comments $ git log Orangebugs. javacommit c919ced7f42f4bc06d563c1a1eaa1_f2b2420d5author: GIT Admin www.2cto.com Date: Sat Aug 13 22:54:57 2011-0700 Added password strength meter functionality commit limit: GI T AdminDate: Sat Aug 13 20:08:02 2011-0700 Initial upload of the project author ..
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.