using git in vs
First, the concept
Git is an emphasis on the speed of distributed version control software and source code management systems (SCM,source Codes management). Git was originally a management software designed by Linus Torvalds for kernel development. since Git was launched, it has been adopted by many open source projects. Each Git working directory is a repository with full history and version information, independent of the network and the central server.
Github
GitHub is a platform, a website that provides users with the means to create a git storage space , save (hosted) User data documents or code, etc. in summary,Github is just a server that provides storage space for storing git repositories . There are many similar sites, such as the code cloud and so on.
Second, why to use Git
- smoother workflow, full offline operation during development
- fast, git distributed architecture allows the local repository to contain all the historical version information, you can quickly switch between different versions
- Git
- warehouse directory structure concise, using Git Copy a project and only create a . Git
- content is stored in metadata, and all version information is located in . Git directory
- Good integrity, easier collaborative development
- large user base, There are now thousands of open source projects using git Github There are countless code warehouses on the
Iii. The difference between git and svn
Git is a distributed version control system with two warehouses, one local repository and one remote repository. The code submission is submitted locally (so fast), of course, patches are generated(patch) and then pushed (push) To the remote server is the need to network , SVN is a centralized version control system, only one Remote Storage, code submission is submitted to the remote server, It needs to be networked all the time (at such a slow pace )
The centralized version control system such as SVN, its complete code warehouse (the code warehouse contains not only the code, but also the various historical versions of information, etc.) on the central server, once the central server is hung up, that is, the complete code warehouse hangs, Although you may have previously obtained code from a central server, those historical version information is not available, and you can no longer commit the code.
Gitdifferent,gitwithout the concept of a central server, everygitClient (gitnode) contains a complete code repository (provided that you have previouslygitWarehouseFetchcode), so those historical version information is on your local machine,gitnode hangs out, feel free to move from othergitnodeCloneA code warehouse came up onOK, the original code, the version information and so on are still intact (of course, if you hang out of thegitThe new code on the node is not dropped.)
on top of that, every git node ( the git node is a full code repository the first time you get the code from a remote git repository ) equals SVN 's central server, which contains the full code repository
Iv. using git in vs
We 've installed git in VS, We just need to open it in Project-Team Explorer
Some common terms for git :
Cloning (clone): clones the full git repository (including code and version information) from the remote server to its own machine
commit : submit your own modified code to the local repository
Pull ( sync ): pulling new code from the remote repository to the local repository ( must be submitted at the time of Pull )
Push (push): push the modified code to the remote repository
Conflict: conflicts occur because git cannot merge modified content automatically when conflicts occur , and we need to manually merge conflicts
Process :
first on the server (GitHub, code Cloud ) New Project on , in the vs is generated in a locally specified folder after cloning in the . Git The hidden file , all of the files that Git uses for versioning and content tracking are in this folder . We just need to put the code in the folder that contains the. git file and push it, so it's pushed to the remote repository. After you modify the code, you also submit a push. If the remote repository has new updates, we only need to pull them.
Attention
There are three types of widgets in Git: Modified, staged, submitted
Submitted indicates that the file has been safely stored in the local database, modified to indicate that a file has been modified, but has not yet been committed, and that a staged representation puts the modified file on the list to be saved on the next commit.
Understanding Branches
What is the use of branching (branch)? Suppose you are ready to develop a new feature, but it takes two weeks to complete, the first week you write the 50% Code, if submitted immediately, because the code is not finished, the incomplete code base will cause others can not work. There is a huge risk of losing your daily progress if you wait until the code is all written and then submitted again.
Now that you have a branch, don't be afraid. You create a branch of your own, others do not see, but also continue to work on the original branch, and you work on your own branch, you want to submit the submission, until the development is complete, and then once merged into the original branch, so that it is safe, and does not affect the work of others
Branching Internal principle
1.as shown in, each commit of the version,git concatenates them into a line based on the point at which they were committed. At first there was only one timeline, the master Branch, andHEAD pointed to the current version of the current branch.
2 When a new branch was created, such as dev branch git Create a new pointer dev dev=master dev point to master point to the version, and then switch to dev branch   head pointer pointing to dev
3. when coding development on the Dev branch, the pointer moves on Dev , such as commit on the dev branch once, Dev The pointer moves forward one step, but Master The pointer does not change, as follows:
4. When we have completed the work on the dev Branch, we will merge the branch and Merge the contents of the Dev branch onto the Master branch . . The internal principle, in fact, is to first point the HEAD pointer to master, and then the master Pointer to the current Dev the content that the pointer points to. Such as.
5.conflicts (Confict) when merging branches, such as commit a file on the dev branch file1 , while at Master the file was also submitted on the branch file1 , where the changes are different (for example, the same statement is modified), then there is a possibility of conflicts when merging, as shown in
。
atthis point, git performs the merge by default, but to manually resolve the conflict and commit it, the structure of the Git branch is now
reference Documentation :
http://blog.csdn.net/chenj_freedom/article/details/50543152
http://blog.csdn.net/wengpingbo/article/details/8985132
http://www.nowamagic.net/academy/detail/48160210
Using Git in VS