1. Use of Git
1. Install git
Website: https://git-scm.com/download/winCopy the code
2. Perform global configuration after installation
git config --global user.name "Username"
git config --global user.email "Email address"
Copy the code
And the credentials are set3. Remote versus local repositories (there is one in every Git project. Git folders are hidden.)
Remote: code stored remotely Local: code stored locallyCopy the code
Cloning of 4.
git cloneThe warehouse addressCopy the code
Clone the remote repository code locally. A clone to a local repository is a local repository
5. After temporarily saving the contents of the local repository code (add, modify, delete), use Git add. Save the modified file temporarily in the staging area
Git commit -m “Commit info (custom)” to commit the file to the local repository
7. After the function of pushing local code is completed, git push will be used to push the code to the remote repository for synchronization with the remote repository
Use Git pull to pull remote code
Summary: the process is: Clone -> Modify file -> Temporary save -> Submit -> Push pull -> Modify -> Temporary save -> Submit -> Push
2: Branch (default git project only has one branch, master)
A project has only one master branch. You cannot program on the master branch. You can only merge other branches into the master branch
The develop branch needs to be created manually and can be developed on the Develop branch
If there are new feature requirements, create a new feature branch on the Develop branch, develop new features, and merge them into the Develop branch
Three: the operation of each personnel
Managers: Project managers need to add developers to the project
1. Create projects
Git init: create a new folder, open CMD in this folder, initialize the project directory with git init, git cannot recognize the empty folder, you need to add. Gitkeep file in the empty folder, this file has no meaning, it is used for placeholder
Note: What if the git folder is hidden when initializing the project?
2. Create a branch
Create develop from master
Developers: Developers face the Develop and Feature branches
1. Check out branches
Check out a new branch from the Develop branch named feature-feature
Development of 2.
Development on new branches, frequent temporary storage, submission, and push (these three only involve local feature and remote feature)
3. The merger
After development, merge our corresponding feature branches into Develop
Switch to Develop, select branch merge, and select your own feature branch
(Optional) Delete the current feature branch. After the feature development is complete, you can delete the corresponding feature branch
Release version
Test before you release, check out the Release branch from develop, test it, fix any problems, and merge them into Develop. Once all the bugs are fixed, merge Develop onto master for release. After a release, mark it as an official release v1.0 v2.0 v2.01
Five, hot repair
If there is a problem with hotfix-v, check out the hotfix-v version number, merge the fix to master and Develop, and mark v1.01 on master
6. Ignore files
To make git unaware of some files, you can use the.gitignore file to remove related files and folders and ignore them
1. Ignore folders
1. / Folder name / 2Copy the code
2. Ignore the file
The file nameCopy the code
3. Ignore files in a folder
/ Folder/file nameCopy the code
4. Ignore the file type
Suffixes *.Copy the code