01.GIT Introduction
SVN is a centralized source control tool that must be networked to operate
Git is distributed. There are two: one is the local code repository, one is the remote code warehouse
Distributed source code management tools
A.GIT-Local Code warehouse usage Process
1. Create a local code repository : git init
2. Configure git repository information , name and mailbox ( You can use the command line , you can open the config file directly )
3. Review the status before submitting the file . git status
4. add files to staging area git add
5. commit file git commit -m"log information " [Path]
02-2.git Remote code warehouse usage Process
1. Create a new Remote Library folder repository, cd path,
2.git Init--bare Creating a remote code repository
The above two steps are to create a remote code warehouse locally. Here's how to clone code from a remote repository to a local
3.CD local file path manager, and then git clone URL (the path to the remote repository) clones the code locally.
Configure config file, git config user.name XXX enter, git config user.email [email protected]
4. ignore the unwanted cache file gitignore,
1) from GitHub. Search for gitignore third-party frameworks (more than 30,000 stars) in COM.
2) Click in, Download ZIP download the next two
3) Command + f search find Objective-c. Gitignore file
3) put put it into the local path manager and ask for and . Git peers on the directory
4) put objective-c. Gitignore, remove the OBJective-c, change to. gitignore hidden files
5). CD local file path, execute command git status separately, git Add. Gitignore,git commit-m "Configure. Gitignore file"
5. Create a new Xcode project and store It in the file path manage/repository in the third step.
6. Write code in the project, source control-->commit
7. If you are prompted to fetch first, the version expires, you need to update the code,source Control---> pull
8. Update is if there is code conflict, the result method:
03 Help
Get help : git helps
Get help for a child command.For example, viewGit clone help : git< Span lang= "en-us" > help clone, git manual ( non-compiled vim) interface space is the page b: Return to previous page exit git manual search :/ keywords
add once . And in svn Only one operation can be
if submitted git commit No write -m" comment ", vimi Enter edit mode exit edit mode . exit vim : wq
Three major areas of git:
.GIT Other instructions
1. View version information :
2. Introduction to viewing version information
3. discard the code that was not submitted and go back to the previous version. Git log was recently committed :git reset--hard HEAD no ^
git reset--hard head^ a ^ represents the second last version submitted Two ^ is the third version
4. View new Code
5. Contemporary code in the workspace, revoke the code with git checkout instructions. If git add is added to staging area, you need to use the git reset command
05. Other
1. View historical information: Source Control--and history
2. View a log of a file: You can also see where the changes have been made. The second picture pops up as soon as the first picture is done
The difference between 3.git and SVN:
1/git each new modification requires add, which is added to staging area. SVN only needs to be added once
2/git each computer has a warehouse, SVN only needs a remote server
3/git is submitted to the local repository before committing to the remote server
4. View the Remote warehouse URL
5. Create a branch. Any modification in the branch does not affect the primary branches code. And you can switch back and forth between the Branch and the primary branches.
Source code control Tools git