Recently once again, with the cooperation of the project, because two people lack of experience, using the U-disk for Unified Code management method (simply to die), so learned from the bitter, decided to study the GitHub this open source version control artifact, for the next project to lay a good foundation for cooperation.
First, the need to do is to install git on your system, because the downloaded Xcode already has git tools, open Xcode, select prefercence, select download Download Commandtool
Then on the machine to initialize a repository,mkdir directory for Git, in the directory using GIT init can be successful after the directory to see. git hidden files
Create a new file under the file Readme.txt use git add Readme.txt to submit the file to the repository using git commit-m "test" to confirm the submission
Use git status to see if a file has been modified (and not yet committed), and if a file has been modified, you can use Git diff to see what's changed. For a modified file,
Repeat the git add filename git commit action above to save the file changes
Then there's the action on version fallback
By using the git log command, you can view the version modification and the version number of each operation, and with these version numbers, we can easily travel through time.
You can see here a total of two records, the first one is I add content for Hellow world! Readme.txt file, and then I added the changed line to the file and saved the changes using git add git commit. This is where we can use git reset for version fallback operations, either with the git reset--hard version number, or by adding ^ to the HEAD, for example, head^ represents the previous version, head^^ represents the previous version of the previous release .... And so on, for too many ^ ^^ we can also directly use head~ numbers to express. Also, for the method represented by the version number, you do not need to enter the full version number to do the operation, enter 6-7 bits, but not too little, or git pits can not determine exactly which version.
The following is a local git repository associated with a remote repository on GitHub
First you need to create an SSH key
Ssh-keygen-t rsa-c "Youremail@example.com"
Enter the appropriate. SSH folder, copy the contents of the Id_rsa.pub (public key), log in to your account on GitHub, and add an SSH key
Select Creat new repository after completion
After typing some commands on the command line, the local git repository is associated with the remote repository on GitHub, as appropriate.
You can then use the appropriate instructions to push content to the remote repository or clone from the remote repository (~_~)
Build git and initial use on Mac OS