Git is a distributed version control system, and the version control tools we use most often have SVN. Here we have to distinguish what is distributed version control system, what is centralized version control system.
Centralized version control system
Centralized versioning system (centralized version control systems, abbreviation CVCS). Such systems, such as cvs,subversion and Perforce, have a single, centrally managed server that keeps revisions of all files, while people working together connect to the server through the client, removing the latest files or submitting updates.
Advantages:
1. Everyone can see what others have done
2. Administrator administrative privileges are also relatively simple
Disadvantages:
Depending on the central server, there is a risk of a single point of failure.
1. When the central server goes down, it can't work together
2. If the file of the central server is damaged and there is no backup, the lost data cannot be retrieved.
distributed version control system
Distributed Versioning systems (distributed version control system, referred to as DVCS). In such systems, such as Git,mercurial,bazaar and Darcs, the client does not just extract the latest version of the file snapshot, but instead completely mirrors the code repository. As a result, any server that works together fails and can be recovered using any of the mirrored local repositories afterwards. Because each fetch operation is actually a full backup of the code warehouse at one time.
Advantages:
1. Suitable for distributed development, emphasizing individual
PS: Allow thousands of parallel development branches to be supported
2. Public server pressure and data volume are not too large
3. Fast and flexible
PS: Especially when playing branches and tag
4. Conflicts can easily be resolved between any two developers
5. Work offline
PS: Local Warehouse
Disadvantages:
Code confidentiality is poor, and once the developer clones the entire library, all code and version information can be fully exposed
Branch
The most critical part of Git is branching, which means that you can detach from the development line and continue working without affecting the mainline. If you want to understand git, this is the most important, you can view the following learning materials.
Learning Resources
This article simply records some things, and does not talk about how git works, how to use, because the data is very perfect, use to view.
1. Liu Xuefeng git tutorial (Chinese)
Http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ 0013744142037508cf42e51debf49668810645e02887691000
2. Graphic git/graphical git reference manual (understanding the principle is very useful)
http://blog.jobbole.com/22647/
3. Git official tutorial (English)
Http://git-scm.com/blog
4. Git-Generate SSH public key
-git-generated-ssh-public key on the https://git-scm.com/book/zh/v1/server
Download git
1. Windows git install package
https://git-for-windows.github.io/
2. Mac
Git install tool: http://sourceforge.net/projects/git-osx-installer/
Install via Xcode: Xcode->preferences->downloads, select "Command line Tools"
Eclipse Git
I am a lazy person, do not like to command to operate git, visual operation is what I want, so I looked for the use of the Git method on eclipse.
1. Install git plugin egit on Eclipse and use
http://yufenfei.iteye.com/blog/1750124/
2. Resolving cannot open git-upload-pack issues in Egit in eclipse
Http://www.xuebuyuan.com/1587775.html
Summarize
What version control tools are used, whether centralized or distributed, no one who absolutely replaces who, exists all the reasons, each with its own applicable scenario.
Appendix
Some commands are recorded below, from the training tutorial
Create a git repository
Initializing the Git repository
$ git init
Configure user Information
$ git config user.name ' someguy ' $ git config user.email ' [email protected] '
Add File
Create a file
$ Touch Readme.md
View the current status of the warehouse
$ git status
Add files to Staging area
$ git Add.
Submit staging Area file to warehouse
$ git commit-m ' Add readme.md file '
Submit Changes
Adding modifications to the staging area
$ git Add readme.md
Commit the changes in staging area to the warehouse
$ git commit-m ' edit readme.md '
Revoke
Undo the Add to staging area operation
$ git reset HEAD readme.md
Undo the changes you made to the file
$ git checkout-readme.md
Commit the changes in staging area to the warehouse
$ git commit-m ' edit readme.md '
Version rollback
View submission History
$ git log
Back to the last commit
$ git reset--hard readme.md
Returns the most recent commit
$ git reset--hard 0ff9
Linking to a remote repository
Add a remote repository
$ git Remote add origin [email protected]:gongke/gitlession.git
Submit code to the local repository
$ git commit-a-M ' will commit to remote '
Pushes the local master branch to the remote Origin branch and establishes a connection with it
$ Git push-u Origin Master
Commit, merge branches on a branch
Modify several files, submit
$ git commit
Switch back to the master branch
$ git Checkout Master
Merging branches
$ git Merge dev
Delete Branch
$ git branch-d dev
Merge with conflicts
Create a new branch and switch to it
$ git checkout-b new_feature
Merging branches
$ git Merge new_feature
If there is no conflict, it will automatically generate a commit if a conflict occurs, you need to resolve the conflict manually, and then submit
$ git add conflict_filegit commit-m ' conflict solved '
Hit label
Create a label
git tag v1.0git tag-a v1.1-m ' 1.1 released! '
View Tags
git tag
Delete a label
Git tag-d v1.0
Push the label to the remote
git push --tag
Git Distributed version Management