Git Code management tool learning
Distributed management tools: Git
Compared to SVN it is more convenient, basically our operations are conducted locally.
Three states of Git files: committed, modified, to staged.
Committed: Indicates that the file has been saved to the local database.
Modified: A file has been modified.
To staging: The modified file is placed in the next submitted saved list.
Git is only concerned about whether the overall file system has changed, and other versioning tools are more concerned about whether the content of the file has changed.
Git's basic work flow
1: Modify some files in the working directory, 2: Take a snapshot of the modified file, and then save to the staging area. 3: Commit the update to permanently dump the file snapshot saved in the staging area to the Git directory.
Git usage tips
All the branches that we created with git are done locally, and the branch does not go to the server to consume memory. Only if we merge the branch will we agree to commit to the server.
This is a powerful place for git, where it stores a vault (stored as metadata) on the server, stores a change data repository for changes such as a version and branch change, sends a request to the server each time we switch, and the server changes the files in our project according to our request. The entire process is fast transmission, and the server does not store each branch of the file copy, which is the GIT service side repository does not increase the cause of the explosion.
2: When using the Tortoisegit tool, red indicates the new branch, green indicates other branch change information.
3: The difference between pull and get
Pull: Gets the latest version from the remote and then merges (Merge) to the local library.
Get (FETCH): The latest version is obtained from the remote and does not merge (merge) to the local library.
It can be said that pull = get (fetch) + merge (merge), we can from a security point of view so much more secure, we can get to the latest version after we make a comparison in a selective merge, after the replica branch and the local version comparison after merging, after the submission to the remote host.
Some basic things to do with Git in 4:vs
Pull: Merge remote repository to local repository (equivalent to Fetch+meger)
Get: Get the latest version from the remote repository.
Merge: Merge two repositories.
Submit: Submit to the local staging repository;
Push: Pushes all changes to the remote library.
Synchronization: Pull first, then push the local library to the remote library, note the order.
5: Submit
Here we modify the code, we click Submit, will go to the following interface, we need to write a note (what the code modified). The following are the meanings of these three submissions;
Commit: Save the file to the local repository;
Commit and push: Save file changes to both local and remote repositories;
Commit and Synchronize: Commit the file changes to the local library, and from the remote version to the latest version to local, push the local library to the remote repository.
Note: The operation here does not target the current file, but commits, pushes, and synchronizes all changes.
6: Create a branch
Here the creation branch is divided into
Two, local branch and remote branch.
The local branch must obtain the latest version before it is created, and the remote branch requires all members to be able to push the changes. For the far branch, we must cancel this option of tracking the remote branch, otherwise the trace branch created cannot be published.
For the study of git I still need to continue to study, I later in the project to slowly learn the use of git, so that their own to the company can quickly into the company.
Git version Control tool learning