one use
Git version control has gradually replaced version control such as cvs, svn, etc. For a programmer, using git is also a necessary homework.
1. Warehouse initialization
View the file. If there is a .git folder, it means that the local repository was created successfully (.git is a hidden folder)
2. Modify username and email
Local configuration:
Note: When there are usernames in both the global configuration and the local configuration, the local configuration has a higher priority
3. Modify the local directory configuration file (remote warehouse address)
4. Pull the project from remote to local
step:
(1) Create an empty folder
(2) Pull the project from the remote to the local
result:
Looking at the folder, you will find that the remote project has been cloned to the local
In this way, the process of pulling the remote project to your computer when you just arrived at the company is completed.
5. Commit local code to remote
(1) Create a new file/modify the code
(2) Add our new/modified code to the to-be-submitted list
Note: The following warning is just a symbol conversion, you can Google if you are interested, don't worry about it, at this time the code has entered the list to be submitted
(3) Submit the code in the to-be-submitted list to the local warehouse
result:
(4) Submit the local project code to the remote warehouse
The results show that:
At this point, looking at the remote project, you can see the code we just submitted
Note: Here I am using coding.net
Of course, you can also submit the project to github
Here, it is recommended to put public projects on github, company projects or private projects on coding.net
6. Ignore part of the file submitted to the remote
When submitting a project, many files should not be submitted to the remote
For example database configuration, such as cache, etc.
Create .gitignore in the root directory (note that this file must be at the same level as .git)