1. Common version control system
(1) -svn centralized version management system;
(2) git distributed version management: working area, temporary storage area, historical area
Two, common commands
1. Initialize a warehouse-enter the folder you want to version management
git init
2. Configure personal information
#personal name
git config --global user.name 'xxx'
#Personal Mailbox
git config --global user.email '[email protected]'
3. Submit from the work area to the temporary storage area
git add . #提交全部文件
git add -A #提交全部文件
git add <files> #指定提交的文件
4, submitted from scratch to historic district ------ Note: If no -m
options, will enter the vim
editor to write relevant information
git commit -m '提交的相关信息'
Note: Red represents in the work area, green represents in the temporary storage area
5. View the submitted historical version
git log #查看详细的提交信息
git log --oneline #查看精简的历史信息
6. Switch historical version
git reset --hard 版本标识符
Other commands
①View the content of the file: cat 1.txt ②New
: touch 1.txt ③View the
current status: git status
④Add content to the file vim 1.txt
Three, GitHub use
1. Create a warehouse
2. Submit a remote warehouse [The first submission requires authentication]
Be sure to remember to submit the
git push address of the remote warehouse master from the historical area.
Note: When submitting to the remote, first submit the local code to the local historical area
3. Pull [remote synchronization code from remote]
git pull the address of the remote warehouse master
Question: In the second submission, the following problem may occur:
Cause Analysis:
By checking the prompt information, I found that it was caused by the inconsistency of the files in the local warehouse and the remote warehouse, that is, GitHub allows local things, but not in the remote warehouse.
solution:
Before push submission, synchronize the files of the local warehouse and the remote warehouse. Use the following command:
git pull --rebase 远程仓库地址 master
After success, the prompt is as follows:
Then you can continue to push your own code, and submit
4. Condition things to someone else's warehouse (submit job)
① First open someone else's warehouse to find the corresponding-click on the right Fork to pull-then jump
Go to your own warehouse- ②Just find a folder and open git-enter git clone remote address master-after cloning is completed, go in and create your own files-start submitting the temporary storage area-historical area-git pull the address of the remote warehouse master-own warehouse has the
③ submit it to the teacher: open your own GitHub- press New pull requests- on the right - click to create pull into the right request- continue to point create pull request
fork --> Pull requests
- fork a project
- Go back to my github and you can see the project from fork
- Clone this project
git clone https://github.com/"you"/"you repositries"
- Then you can perform the corresponding operations
- Submit the modified file to github (Note: Submit to the local history area before submitting)
- Go back to github and initiate Pull requests
Fourth, the use of code cloud
(1) First git clone the project address [pull the project to the local]
(2) git add.
(3) git commit -m'Comment for this submission'
(4) git push [The project content was successfully pushed to the code cloud 】