linweijian / linweijian.github.io

林伟健博客
0 stars 0 forks source link

版本控制工具 #5

Open linweijian opened 6 years ago

linweijian commented 6 years ago

git命令

https://segmentfault.com/a/1190000009617572 https://git-scm.com/book/zh/v2 http://www.bootcss.com/p/git-guide/

日常

git clone 'xxxxx' //拉取仓库 git pull origin master//拉最新 git fetch //不会自动merge

git add . //提交缓存区 git commit -m 'xx' //提交修改

git checkout -b 'new branch' //新建分支 git checkout 'branch'//切换分支 git branch//查看分支 git branch -D 'branch' //删除本地分支 git push --delete origin branch //删除远程分支

git status //查看修改状态 git reset --hard //撤销

git clean //工作目录中移除没有track的文件. git checkout . //放弃修改的文件 git clean -df -n 显示 将要 删除的 文件 和 目录 -f 删除 文件,-df 删除 文件 和 目录 git reset --hard FETCH_HEAD,FETCH_HEAD 表示上一次成功git pull之后形成的commit点

git merge --squash git merge --no-ff

linweijian commented 6 years ago

手动Merge Request

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b feature-supercall-cb origin/feature-supercall-cb

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git checkout develop
git merge --no-ff feature-supercall-cb

Step 4. Push the result of the merge to GitLab

git push origin develop

Tip: You can also checkout merge requests locally by following these guidelines.