1. Install Git client
-
Here we provide you with the Windows version of Git client and detailed installation documentation. Baidu Netdisk:
https://pan.baidu.com/s/1CDu0Ke199pt3Ysv-QtWObA
Extraction code: 8888
-
If it expires, please leave a message and contact me.
2. Register a code cloud account
-
Open the code cloud website: https://gitee.com/
-
Click register to submit information
3. Create a remote branch
Create a remote warehouse
4. Pull the remote branch to the local (at this time, both the remote branch and the local branch are available, and an association is established)
-
Find the remote warehouse and copy the warehouse address
2. Clone the remote warehouse to the local through the warehouse address
-
Find a directory to store your local warehouse
-
Enter the command line in the directory, enter cmd in the address bar and press Enter to enter the command line in the current directory.
3. Enter the command in the command line and press Enter, the remote warehouse will be copied to your local.
5. Submit your project to the remote warehouse
Copy your project to the local repository just now, and then submit it to the remote repository.
1. Set the email
Git config --global user.email "The email address filled in by your registration code cloud"
2. Set the user name
Git config --global user.name "The name of your registration code cloud"
3. Add all files to the cache area (. means all files, you can also specify a file or folder, just write the name directly)
Git add.
4. Submit the files in the cache area to the local warehouse
Git commit -am "description information of this submitted file"
5. Submit the local master branch to the remote warehouse master branch (because the local and remote corresponding branches are called master)
you need to add the -u parameter for your first submission, and you can use Git push directly in the future.
Git push -u origin master
6. Other commonly used Git commands
✡✡✡✡✡
1. View the local branch
Git branch
2. View the remote branch
Git branch -r
3. Check the relationship between the local branch and the remote branch
Git branch -vv
4. View the commit log
Git log
and press q to exit
5. Create a branch
Git branch your_branch_name
✡✡✡✡✡
6.Switch branchGit
checkout your_branch_name
7. Create a branch and switch to the new branch
Git checkout -b your_branch_name
8. Create a new branch based on a certain branch
Git branch branch1 branch2
9. Pull the branch code to local
Git pull
10. Delete the local branch
Git branch -d bugfix01
✡✡✡✡✡
11. Delete the remote branch
Git push origin --delete bugfix01
12. Force commit to remote branch
Git push -f origin you_branch_name
13. Branch merge (merge the bugfix01 branch to the master branch)
① Switch to the master branch
Git checkout master
② Merge branch
Git merge bugfix01
③ Submit
Git push
14. Branch rollback
回滚机制说明:
1、在Git中,用HEAD表示当前版本
2、上一个版本就是HEAD^
3、上上一个版本就是HEAD^^
4、通过数字表示之前100个版本HEAD~100
5、git log可以查看提交历史,查看commit_id,按q退出
6、回滚命令
git reset --hard commit_id
15. Force coverage of local warehouse
-
Download the latest version from the remote repository
Git fetch --all -
Set the local to the latest content just obtained
Git reset --hard origin/master
16.Conflict resolution
<<<<<<< HEAD
...
自己提交的代码
...
=======
...
下来的代码
...
>>>>>>>master
说明:
head到=======是自己提交的commit内容
======到>>>>>>master是下拉的pull内容
删除=======和>>>>>>和重复的代码即可,再推到远程仓库。