Git-分支管理
来源:互联网 发布:大连淘宝职位招聘网 编辑:程序博客网 时间:2024/06/06 20:58
1、分支冲突
当在分支里改变了某个文件,然后又在master分支里修改了文件,那么在master分支里,合并分支的时候会出现错误,
Auto-merging README.mdCONFLICT (content): Merge conflict in README.mdAutomatic merge failed; fix conflicts and then commit the result.
查看文件,并将两个分支里的文件内容修改一致,在合并即可。
2、通常在合并分支的时候,Git会使用Fast-forward模式合并分支,删除分支之后,会丢失分支信息。如果合并的时候加上--no-ff
参数表示禁用Fast-forward模式,表示该用普通模式合并,合并后的历史有分支,能看出曾经做过合并
git merge --no-ff -m "information" branchName
information:表示这次合并的信息
branchName:表示和将那一个分支合并到本分支中
3、当遇到bug的时候,将当前的工作区存储起来,使用
git stash
这时就可以转换到别的分支了进行别的操作,恢复工作区状态,
git stash apply -----用以恢复工作区状态git stash drop -----删除stash
也可以使用
git stash pop -----恢复工作区的同时,删除stash
可以使用
git stash list ------查看stash
4、如果分支在没有合并之前,需要删除,可以使用
git branch -D branchName -----强行删除branchName分支
5、查看远程仓库的信息
git remote
若要查看更加详细的信息,可以使用
git remote -v
6、推送分支
git push origin branchName
其中branchName为本地分支
7、从远程仓库抓取分支,使用
git pull
如果有冲突,则按照提示解决冲突。我的电脑冲突提示为
There is no tracking information for the current branch.Please specify which branch you want to merge with.See git-pull(1) for details. git pull <remote> <branch>If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> dev
按照最后一行的提示设置即可
阅读全文
0 0
- 3.3 Git 分支 - 分支管理
- git 分支管理-----本地分支,远程分支
- Git分支管理
- Git 创建管理分支
- Git分支管理策略
- Git分支管理策略
- Git分支管理策略
- Git分支管理策略
- Git分支管理策略
- Git分支管理
- git分支管理
- Git远程分支管理
- git分支管理策略
- Git分支管理策略
- Git分支管理策略
- Git分支管理策略
- Git 分支管理策略
- Git分支管理策略
- Android中传统的SQLite使用方式
- 由c#程序中的static Main() 浅谈 static的含义
- js中数组的用法
- ARP协议及脚本编写u
- Java 枚举(enum) 详解7种常见的用法
- Git-分支管理
- vim使用基础(一)
- 服务器操作记录cmdtrack
- 面向对象的设计原则:依赖倒置
- MapReduce WordCount源码解析
- HDU 6047 Maximum Sequence (贪心,线段树)
- python简单数据探索之计数方法
- centos7安装mysql5.7.18完整实用教程
- HDU 1029Ignatius and the Princess IV