1.全局设置
git config --global user.name "lizhengguang"
git config --global user.email "zzlxxi@163.com"
2.克隆代码到本地
git clone http://192.168.2.107:30000/lizhengguang/learn-blade.git
cd learn-blade
touch README.md
git add README.md
git commit -m "add README.md"
git push -u origin master
3.推送本地代码到分支
cd learn-blade
git init
git remote add origin http://192.168.2.107:30000/lizhengguang/learn-blade.git
git add .
git commit -m "Initial commit"
git push -u origin master
4.推送本地代码到新分支
cd learn-blade
git remote rename origin old-origin
git remote add origin http://192.168.2.107:30000/lizhengguang/learn-blade.git
git push -u origin --all
git push -u origin --tags
5.删除远程分支
// view local remote addresses
git remote -v
// delete local remote address
git remote remove origin
6.回退指定版本
// https://blog.csdn.net/yxlshk/article/details/79944535
// https://www.cnblogs.com/aligege/p/10221174.html
6.1 git revert
-----------------------------------------------------
git revert -n commit
git commit -m "revert"
git push
6.2 git reset
-----------------------------------------------------
git log
git reset --hard commit
git push -f -u origin branch
7.本地代码合并
Check out, review, and merge locally
Step 1. Fetch and check out the branch for this merge request
git fetch origin
git checkout -b 1.0.1-dev origin/1.0.1-dev
Step 2. Review the changes locally
Step 3. Merge the branch and fix any conflicts that come up
git checkout v1.0.1
git merge --no-ff 1.0.1-dev
Step 4. Push the result of the merge to GitLab
git push origin v1.0.1
Tip: You can also checkout merge requests locally by following these guidelines.