Git 技巧
来源:互联网 发布:电脑版扫描软件 编辑:程序博客网 时间:2024/06/05 04:25
Q1: 代码写到一半,需要跟别人同步怎么办?
Icon
git stash –
Stash the changes in a dirty working directory away
使用场景:
- 代码写到了一半,但是还没有到可以提交的程度。这个时候同伴说,你拉一下代码。
- 总之就是临时想保存下代码。。。。
操作步骤:
git stash // 暂存代码
git pull // 拉取最新代码
git stash pop // 取出暂存的代码
查看 暂存的代码栈
git stash list
Q2. 如何提交代码
最优雅的方式( 走代码review)
1. git checkout alpha // alpha = 你们用来同步代码的分支
2. git pull //同步代码
3. git checkout -b leo-featureA// 你自己的开发分支,或者feature分支
4. // 写代码
5. git fetch origin alpha
6. git rebase origin/alpha // 注意origin 和 alpha之间不一样
6.1 // 如果有冲突,解决冲突
6.1.1git add xxx // xxx是冲突的文件
6.1.2git rebase --continue
6.2 // 如果有冲突,且自己解决不了,准备放弃。或者搞到一半,搞不下去,想从头再来
6.2.1git rebase --abort
6.2.2// 从5开始,或采用其他方案
7. git push origin leo-featureA
8. // 去gitlab 上创建 merger request
Q3. 清理不必要的文件
Icon
git clean
简单粗暴的方式:
git clean -fdx
0 0
- GIT技巧
- git 技巧
- Git 技巧
- Git技巧
- Git - 技巧
- Git - 技巧
- git 技巧
- Git技巧
- git 技巧
- git 技巧
- Git技巧
- git技巧
- Git 技巧
- git技巧
- git 技巧
- Git使用技巧篇
- git 小技巧
- Git 技巧记录
- html table属性测试,练习+详解(亲测)
- Eclipse搭建Gradle环境
- 常见Oracle数据库操作
- Android UI设计--ListView的页脚(footer)的使用
- 为什么release版本的activex 注册失败?而debug版本的却能注册成功?
- Git 技巧
- spark on yarn的那些事 ---第一篇
- 第十五期 MIPS汇编U-Boot从start.S开始《路由器就是开发板》
- Android之SurfaceView使用总结
- Mongodb创建collection
- 被python坑怕了,怀念java
- SpringSecurity实现登录认证及权限验证
- Container With Most Water水箱问题
- 事件的委托