git learning records
1. Git it works: Object Model
git all of the above historical information through a 40-bit file name of the object indexing. The object name used SHA1 algorithm, in fact, the file message digest.
Content, size, type
Introduced four types:
blob object: that is a binary data storage, and file names, directories, etc. nothing to do. If two files have the same version of the same content repository, it will share the same blob object. You can git show ....... command.
tree object: in fact, a list list of entries, each entry can point to the blob object can point to the tree object.
commit to: a commit object pointing to a tree, and record the time to submit some information. SHA1 encoding objects, including tree, parent ---- usually the current branch, document those changes, the creator of this submission, comment information
A simple example:
Differences in the svn git:
git will record the entire contents of each commit, svn version control tools such as the difference each commit record.
Svn directory structure and not the same, each project has a git directory. Each subdirectory has a svn svn directory.
add command is not the same:
git add track the content, so not only can add new files. After the file has been modified by git add can also be added to the index, the next commit.
git directory and working directory:
git index recorded a change of information, including which files are temporary, and which files are temporary and so is not modified, use git status command.
2. Git basic operation
1. Git clone: the remote code to copy to a local, you can choose two protocols git protocol and http protocols.
2. Git add: actually put the modified files to the index in order to commit the time to be submitted.
3. Git commit: the submission of the content inside the index and create a new branch.
4. Git status: View some of the current state of the branch
5. Git branch See all branches of the project
Create a new branch
6. Git checkout a branch switch
7. Git diff compare various versions of the differences between branches. Specific operations reference http://gitbook.liuhui998.com/3_5.html .
3. Common Problems
If the two branches have modified the same file, the merger will produce conflict. Use git diff to see changes to file the appropriate conflict of files, the implementation of git add and git commit, on it.
Distributed development mode?
git pull and git push command together