Article directory
basic operation
tip: It is best to operate on git in the warehouse, that is, under the same level directory as .git
- Create a local warehouse
- Submit Commit (submit to local warehouse)
- Push push (push the local warehouse to the remote warehouse)
tip: If the remote warehouse version is newer than ours, the push will not fail, and you need to pull it first
- Pull pull (pull from remote warehouse to local warehouse)
- create branch
tip: Push the branch of the local warehouse to the remote warehouse, and a new branch will be created in the remote warehouse
- switch branch
- Merge branch
tip: switch to the main branch first
- delete branch
advanced
1. Ignore file
It can be selected when creating the library, or it can be used through the git command line: touch .gitignore command
2. Conflict resolution when merging
The reason for the conflict:
the two merged branches have modified the same file and location
method 1:Manual fix
Commit:
Method Two: Use the git little turtle tool
3. Submodules
3.1 Adding submodules to the warehouse
3.2 Cloning a repository with submodules
When cloning a warehouse with submodules, recursive needs to be checked, otherwise the submodules cannot be pulled
3.3 Committing and pushing a repository with submodules
When there is a change in the submodule, it is necessary to submit and push to the submodule warehouse first, and then submit and push to the main warehouse
4. Version rollback
5. Delete test files that are not included in version management
Summary at work (based on TortoiseGit)
1.Pull and Fetch
Pull = Fetch + Merge
Pull will merge the remote code with the local when pulling the remote code, so you can also do this when you need to merge the code of other branches