【Git版本控制 02】分支管理

news2024/9/24 1:16:09

目录

一、创建分支

二、切换分支

三、合并分支

四、删除分支

五、合并冲突

六、分支策略

七、bug分支


一、创建分支

# 当前仓库只有 master 一个主分支
# 可通过 git branch 是进行分支管理的命令,可通过不同参数对分支进行查看、创建、删除

(base) [root@localhost gitcode]# cat .git/HEAD
ref: refs/heads/master
(base) [root@localhost gitcode]# cat .git/refs/heads/master
84b615bfb313b40010c263cbadc67f24ce1ed1d3
(base) [root@localhost gitcode]# git branch
* master
(base) [root@localhost gitcode]# git branch dev
(base) [root@localhost gitcode]# git branch
  dev
* master
(base) [root@localhost gitcode]# ls .git/refs/heads/
dev  master
(base) [root@localhost gitcode]# cat .git/refs/heads/*
84b615bfb313b40010c263cbadc67f24ce1ed1d3
84b615bfb313b40010c263cbadc67f24ce1ed1d3
(base) [root@localhost gitcode]# 

# * 表示当前 HEAD 指向的分支是 master 分支
# git branch 只能查看本地分支,git branch -r 可查看远程分支

二、切换分支

(base) [root@localhost gitcode]# git checkout dev
切换到分支 'dev'
(base) [root@localhost gitcode]# cat .git/HEAD
ref: refs/heads/dev
(base) [root@localhost gitcode]# git branch
* dev
  master
(base) [root@localhost gitcode]# 

# 在新分支上修改文件内容

(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: dev
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "modify file1 for dev"
[dev 088ce6d] modify file1 for dev
 1 file changed, 1 insertion(+)
(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
(base) [root@localhost gitcode]# 


# 为什么 dev分支 和 master分支 上同一个文件的内容不一样呢?
# 我们可以看到 dev分支和 master分支 上两者指向的提交是不一样的

(base) [root@localhost gitcode]# cat .git/refs/heads/dev
088ce6d478daaadbd94870ceebd47bd05bf1b4e1
(base) [root@localhost gitcode]# cat .git/refs/heads/master
84b615bfb313b40010c263cbadc67f24ce1ed1d3
(base) [root@localhost gitcode]# 

三、合并分支

# 先切回到 master分支,再通过 git merge 合并 dev分支

(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
(base) [root@localhost gitcode]# git merge dev
更新 84b615b..088ce6d
Fast-forward
 file1 | 1 +
 1 file changed, 1 insertion(+)
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: dev
(base) [root@localhost gitcode]# 

Fast-forward代表“快进模式”,也就是直接把master指向dev的当前提交,所以合并速度非常快。

四、删除分支

合并完成后, dev分⽀ 对于我们来说就没⽤了,那么 dev分⽀ 就可以被删除掉,注意如果当前正处于某分⽀下,就不能删除当前分⽀。

(base) [root@localhost gitcode]# git branch
* dev
  master
(base) [root@localhost gitcode]# git branch -d dev
error: 无法删除您当前所在的分支 'dev'。
(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# git branch -d dev
已删除分支 dev(曾为 088ce6d)。
(base) [root@localhost gitcode]# git branch
* master
(base) [root@localhost gitcode]# 

因为创建、合并和删除分⽀⾮常快,所以Git⿎励你使⽤分⽀完成某个任务,合并后再删掉分⽀,这和直接在master分⽀上⼯作效果是⼀样的,但过程更安全。

五、合并冲突

在实际分⽀合并的时候,并不是想合并就能合并成功的,有时候可能会遇到代码冲突的问题。

# git checkout -b 可以创建并跳转到新分支
# 分别在 dev1分支 和 master分支上对file1文件修改并提交

(base) [root@localhost gitcode]# git checkout -b dev1
切换到一个新分支 'dev1'
(base) [root@localhost gitcode]# git branch
* dev1
  master
(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: dev1
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "modify file1 for dev1"
[dev1 77f1455] modify file1 for dev1
 1 file changed, 1 insertion(+), 1 deletion(-)
(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: dev
(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "modify file1 for master"
[master b7534ec] modify file1 for master
 1 file changed, 1 insertion(+), 1 deletion(-)
(base) [root@localhost gitcode]# 

这种情况下,Git只能试图把各⾃的修改合并起来,但这种合并就可能会有冲突,如下所⽰:

(base) [root@localhost gitcode]# git branch
  dev1
* master
(base) [root@localhost gitcode]# git merge dev1
自动合并 file1
冲突(内容):合并冲突于 file1
自动合并失败,修正冲突然后提交修正的结果。
(base) [root@localhost gitcode]# git status
# 位于分支 master
# 您有尚未合并的路径。
#   (解决冲突并运行 "git commit")
#
# 未合并的路径:
#   (使用 "git add <file>..." 标记解决方案)
#
#       双方修改:     file1
#
修改尚未加入提交(使用 "git add" 和/或 "git commit -a")
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
<<<<<<< HEAD
write sth. for new branch: master
=======
write sth. for new branch: dev1
>>>>>>> dev1
(base) [root@localhost gitcode]# 

Git会⽤ <<<<<<<,=======,>>>>>>> 来标记出不同分⽀的冲突内容,此时我们必须要⼿动调整冲突代码,并需要再次提交修正后的结果!!

(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "modify file1 for master and dev1"
[master 0dc19d0] modify file1 for master and dev1
(base) [root@localhost gitcode]# git status
# 位于分支 master
无文件要提交,干净的工作区
(base) [root@localhost gitcode]# 

# 用带参数的 git log 也可以看到分支合并情况

(base) [root@localhost gitcode]# git log --graph --pretty=oneline --abbrev-commit
*   0dc19d0 modify file1 for master and dev1
|\  
| * 77f1455 modify file1 for dev1
* | b7534ec modify file1 for master
|/  
* 088ce6d modify file1 for dev
* 84b615b delete file3
* 0f28717 delete file4
* c31b56a modigy: add vertion2
* 167def0 modify: add vertion1
* 7df1e32 modify: file1
* f2e9210 Add three files
* fc3a350 Add first file
(base) [root@localhost gitcode]# 
# 分支使用完最好删除掉

(base) [root@localhost gitcode]# git branch -d dev1
已删除分支 dev1(曾为 77f1455)。
(base) [root@localhost gitcode]# git branch
* master
(base) [root@localhost gitcode]# 

六、分支策略

通常合并分⽀时,如果可能,Git会采⽤ Fast forward 模式。

在这种 Fast forward 模式下,删除分⽀后,查看分⽀历史时,会丢掉分⽀信息,看不出来最新提交到底是 merge 进来的还是正常提交的。

但在合并冲突部分,我们也看到通过解决冲突问题,会再进⾏⼀次新的提交。

那么这就不是 Fast forward 模式了,这样的好处是,从分⽀历史上就可以看出分⽀信息。

Git ⽀持我们强制禁⽤ Fast forward 模式,那么就会在 merge 时⽣成⼀个新的 commit ,这样,从分⽀历史上就可以看出分⽀信息。

# 新建 dev2分支 并在新分支上修改 file1

(base) [root@localhost gitcode]# git checkout -b dev2
切换到一个新分支 'dev2'
(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "modify file1 for dev2"
[dev2 13c3c71] modify file1 for dev2
 1 file changed, 1 insertion(+)
(base) [root@localhost gitcode]#
# 使用 git -merge --no-ff 合并分支会提交一个新的 commit

(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
(base) [root@localhost gitcode]# git merge --no-ff -m "merge with no-ff: dev2" dev2
Merge made by the 'recursive' strategy.
 file1 | 1 +
 1 file changed, 1 insertion(+)
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
(base) [root@localhost gitcode]# git log --graph --pretty=oneline --abbrev-commit
*   cb70524 merge with no-ff: dev2
|\  
| * 13c3c71 modify file1 for dev2
|/  
*   0dc19d0 modify file1 for master and dev1
|\  
| * 77f1455 modify file1 for dev1
* | b7534ec modify file1 for master
|/  
* 088ce6d modify file1 for dev
* 84b615b delete file3
* 0f28717 delete file4
* c31b56a modigy: add vertion2
* 167def0 modify: add vertion1
* 7df1e32 modify: file1
* f2e9210 Add three files
* fc3a350 Add first file
(base) [root@localhost gitcode]# 

可以看出,在 --no-ff 模式下,merge后的分支图为:

所以在合并分⽀时,加上 --no-ff 参数就可以⽤普通模式合并,合并后的历史有分⽀,能看出来曾经做过合并,⽽ fast forward 合并就看不出来曾经做过合并。

分支管理原则

  1. master分⽀应该是⾮常稳定的,也就是仅⽤来发布新版本,平时不能在上⾯⼲活;
  2. ⼲活都在dev分⽀上,也就是说,dev分⽀是不稳定的,到某个时候,⽐如1.0版本发布时,再把dev分⽀合并到master上,在master分⽀发布1.0版本;

七、bug分支

假如我们现在正在 dev2 分⽀上进⾏开发,开发到⼀半,突然发现 master 分⽀上⾯有bug,需要解决。在Git中,每个bug都可以通过⼀个新的临时分⽀来修复,修复后,合并分⽀,然后将临时分⽀删除。

可现在 dev2 的代码在⼯作区中开发了⼀半,还⽆法提交,怎么办?

(base) [root@localhost gitcode]# git checkout dev2
切换到分支 'dev2'
(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
this is a bug ...
(base) [root@localhost gitcode]# git status
# 位于分支 dev2
# 尚未暂存以备提交的变更:
#   (使用 "git add <file>..." 更新要提交的内容)
#   (使用 "git checkout -- <file>..." 丢弃工作区的改动)
#
#       修改:      file1
#
修改尚未加入提交(使用 "git add" 和/或 "git commit -a")
(base) [root@localhost gitcode]# 
# Git提供了 git stash 命令可以将当前工作区信息进行储藏
# 被储藏的内容可以在将来的某个时间恢复出来

(base) [root@localhost gitcode]# git stash
Saved working directory and index state WIP on dev2: 13c3c71 modify file1 for dev2
HEAD 现在位于 13c3c71 modify file1 for dev2
(base) [root@localhost gitcode]# git status
# 位于分支 dev2
无文件要提交,干净的工作区
(base) [root@localhost gitcode]# 
# 储藏 dev2 ⼯作区之后,由于我们要基于master分⽀修复bug,
# 所以需要切回 master 分⽀,再新建临时分⽀来修复bug

(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# git checkout -b fix_bug
切换到一个新分支 'fix_bug'
(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
fix a bug here!
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "fix a bug"
[fix_bug 1ec9fbd] fix a bug
 1 file changed, 1 insertion(+)
(base) [root@localhost gitcode]#  
# 修复完成后,切换到 master 分⽀,并完成合并,最后删除 fix_bug 分⽀

(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# git merge --no-ff -m "merge fix_bug branch" fix_bug
Merge made by the 'recursive' strategy.
 file1 | 1 +
 1 file changed, 1 insertion(+)
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
fix a bug here!
(base) [root@localhost gitcode]# git branch -d fix_bug
已删除分支 fix_bug(曾为 1ec9fbd)。
(base) [root@localhost gitcode]#
# bug的修复⼯作已经做完了,我们还要继续回到 dev2 分⽀进⾏开发。
# ⼯作区是⼲净的,需要恢复现场
# git stash list 查看工作现场列表
# git stash pop  恢复工作现场

(base) [root@localhost gitcode]# git checkout dev2
切换到分支 'dev2'
(base) [root@localhost gitcode]# git status
# 位于分支 dev2
无文件要提交,干净的工作区
(base) [root@localhost gitcode]# git stash list
stash@{0}: WIP on dev2: 13c3c71 modify file1 for dev2
(base) [root@localhost gitcode]# git stash pop
# 位于分支 dev2
# 尚未暂存以备提交的变更:
#   (使用 "git add <file>..." 更新要提交的内容)
#   (使用 "git checkout -- <file>..." 丢弃工作区的改动)
#
#       修改:      file1
#
修改尚未加入提交(使用 "git add" 和/或 "git commit -a")
丢弃了 refs/stash@{0} (f9841933f9d2d3112f4262fc0e5c9f882fea7fd7)
(base) [root@localhost gitcode]# git stash list
(base) [root@localhost gitcode]#
# 恢复完代码之后我们便可以继续完成开发,开发完成后便可以进⾏提交
# 但是修复bug的内容并没有在dev2中显示

(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
this is a bug ...
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "modify file1 for dev2"
[dev2 030cb5d] modify file1 for dev2
 1 file changed, 1 insertion(+), 1 deletion(-)
(base) [root@localhost gitcode]# 

Master 分⽀⽬前最新的提交,是要领先于新建 dev2 时基于的 master 分⽀的提交的,所以我们
在 dev2 中当然看不⻅修复bug的相关代码。

我们的最终⽬的是要让 master 合并 dev2 分⽀的,那么正常情况下我们切回 master 分⽀直接合
并即可,但这样其实是有⼀定⻛险的。

因为在合并分⽀时可能会有冲突,⽽代码冲突需要我们⼿动解决(在 master 上解决)。我们⽆法保证对于冲突问题可以正确地⼀次性解决掉,因为在实际的项⽬中,代码冲突不只⼀两⾏那么简单,有可能⼏⼗上百⾏,甚⾄更多,解决的过程中难免⼿误出错,导致错误的代码被合并到master 上。

解决这个问题的⼀个好的建议就是:最好在⾃⼰的分⽀上合并下 master ,再让 master 去合并
dev ,这样做的⽬的是有冲突可以在本地分⽀解决并进⾏测试,⽽不影响 master 。

# dev2 合并 master

(base) [root@localhost gitcode]# git branch
* dev2
  master
(base) [root@localhost gitcode]# git merge master
自动合并 file1
冲突(内容):合并冲突于 file1
自动合并失败,修正冲突然后提交修正的结果。
(base) [root@localhost gitcode]# 
# 发生冲突,将冲突解决并重新提交

(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
<<<<<<< HEAD
this is a bug ...
=======
fix a bug here!
>>>>>>> master
(base) [root@localhost gitcode]# vim file1
(base) [root@localhost gitcode]# cat file1
hello git
hello world
add vertion1
add vertion2
write sth. for new branch: master
write sth. for new branch: dev1
write sth. for new branch: dev2
i am coding ... done!
(base) [root@localhost gitcode]# git add .
(base) [root@localhost gitcode]# git commit -m "merge master"
[dev2 9604340] merge master
(base) [root@localhost gitcode]# git status
# 位于分支 dev2
无文件要提交,干净的工作区
(base) [root@localhost gitcode]# 
# 切回master,合并dev2

(base) [root@localhost gitcode]# git checkout master
切换到分支 'master'
(base) [root@localhost gitcode]# git merge dev2
更新 1bcd87b..9604340
Fast-forward
 file1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(base) [root@localhost gitcode]# git status
# 位于分支 master
无文件要提交,干净的工作区
(base) [root@localhost gitcode]# git branch -d dev2
已删除分支 dev2(曾为 9604340)。
(base) [root@localhost gitcode]# 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1439566.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

FXTM富拓监管变更!2024开年连续3家交易商注销牌照

交易商的监管信息是经常发生变更的&#xff0c;即使第一次投资时查询平台监管牌照&#xff0c;投资者仍需持续关注其监管动态。千万不要以为第一步审核好后就万事大吉了&#xff01; 2024年开年&#xff0c;就有3家交易商的重要信息发生变更&#xff0c;注销其金融监管牌照&…

Canvas的js库:Konva.js-像操作DOM一样,操作canvas

hello&#xff0c;我是贝格前端工场&#xff0c;最近在学习canvas&#xff0c;分享一些canvas的一些知识点笔记&#xff0c;本期分享Konva.js这个canvas框架&#xff0c;欢迎老铁们一同学习&#xff0c;欢迎关注&#xff0c;如有前端项目可以私信贝格。 Konva.js是一个强大的HT…

零基础学Python之整合MySQL

Python 标准数据库接口为 Python DB-API&#xff0c;Python DB-API为开发人员提供了数据库应用编程接口。 不同的数据库你需要下载不同的DB API模块&#xff0c;例如你需要访问Oracle数据库和Mysql数据&#xff0c;你需要下载Oracle和MySQL数据库模块。 DB-API 是一个规范. 它…

Spring Boot3整合Redis

⛰️个人主页: 蒾酒 &#x1f525;系列专栏&#xff1a;《spring boot实战》 &#x1f30a;山高路远&#xff0c;行路漫漫&#xff0c;终有归途。 目录 前置条件 1.导依赖 2.配置连接信息以及连接池参数 3.配置序列化方式 4.编写测试 前置条件 已经初始化好一个spr…

【daily updating】k3s kubeedge + opendFaas搭建教程 —— 欢迎交流

OpenFaas从入门到实战 – 踩坑指南 &#xff5c; k3dOpenFaas | deploy your first python function https://blog.alexellis.io/first-faas-python-function/ https://docs.openfaas.com/deployment/kubernetes/ 搭建环境&#xff1a;第一种方法失败&#xff0c;第二种方法…

1572.矩阵对角线元素的和(Java)

题目描述&#xff1a; 给你一个正方形矩阵 mat&#xff0c;请你返回矩阵对角线元素的和。 请你返回在矩阵主对角线上的元素和副对角线上且不在主对角线上元素的和。 输入&#xff1a; mat [[1,2,3], [4,5,6], [7,8,9]] 输出&#xff1a; 25 解释&#xff1a;对角线的和为&…

cleanmymacX和腾讯柠檬哪个好用

很多小伙伴在使用Mac时&#xff0c;会遇到硬盘空间不足的情况。遇到这种情况&#xff0c;我们能做的就是清理掉一些不需要的软件或者一些占用磁盘空间较大的文件来腾出空间。我们可以借助一些专门的清理工具&#xff0c;本文中我们来推荐几款好用的Mac知名的清理软件。并且将Cl…

【Docker】Docker Image(镜像)

文章目录 一、Docker镜像是什么&#xff1f;二、镜像生活案例三、为什么需要镜像四、镜像命令详解docker rmidocker savedocker loaddocker historydocker image prune 五、镜像操作案例六、镜像综合实战实战一、离线迁移镜像实战二、镜像存储的压缩与共享 一、Docker镜像是什么…

上下固定中间自适应布局

实现上下固定中间自适应布局 1.通过position:absolute实现 定义如下结构 <body> <div class="container"> <div class="top"></div> <div class="center"></div> <div class="bottom"&…

2023年12月 Python(三级)真题解析#中国电子学会#全国青少年软件编程等级考试

Python等级考试(1~6级)全部真题・点这里 一、单选题(共25题,共50分) 第1题 一个非零的二进制正整数,在其末尾添加两个“0”,则该新数将是原数的?( ) A:10倍 B:2倍 C:4倍 D:8倍 答案:C 二进制进位规则是逢二进一,因此末尾添加一个0,是扩大2倍,添加两个0…

Redis篇之集群

一、主从复制 1.实现主从作用 单节点Redis的并发能力是有上限的&#xff0c;要进一步提高Redis的并发能力&#xff0c;就需要搭建主从集群&#xff0c;实现读写分离。主节点用来写的操作&#xff0c;从节点用来读操作&#xff0c;并且主节点发生写操作后&#xff0c;会把数据同…

LeetCode 133:克隆图(图的深度优先遍历DFS和广度优先遍历BFS)

回顾 图的Node数据结构 图的数据结构&#xff0c;以下两种都可以&#xff0c;dfs和bfs的板子是不变的。 class Node {public int val;public List<Node> neighbors;public Node() {val 0;neighbors new ArrayList<Node>();}public Node(int _val) {val _val;…

【大模型上下文长度扩展】MedGPT:解决遗忘 + 永久记忆 + 无限上下文

MedGPT&#xff1a;解决遗忘 永久记忆 无限上下文 问题&#xff1a;如何提升语言模型在长对话中的记忆和处理能力&#xff1f;子问题1&#xff1a;有限上下文窗口的限制子问题2&#xff1a;复杂文档处理的挑战子问题3&#xff1a;长期记忆的维护子问题4&#xff1a;即时信息检…

Docker的镜像和容器的区别

1 Docker镜像 假设Linux内核是第0层&#xff0c;那么无论怎么运行Docker&#xff0c;它都是运行于内核层之上的。这个Docker镜像&#xff0c;是一个只读的镜像&#xff0c;位于第1层&#xff0c;它不能被修改或不能保存状态。 一个Docker镜像可以构建于另一个Docker镜像之上&…

前端ajax技术

ajax可以实现局部刷新&#xff0c;也叫做无刷新&#xff0c;无刷新指的是整个页面不刷新&#xff0c;只是局部刷新&#xff0c;ajax可以自己发送http请求&#xff0c;不用通过浏览器的地址栏&#xff0c;所以页面整体不会刷新&#xff0c;ajax获取到后台数据&#xff0c;更新页…

RabbitMQ高可用架构涉及常用功能整理

RabbitMQ高可用架构涉及常用功能整理 1. rabbitmq的集群模式2. 镜像模式高可用系统架构和相关组件3. rabbitmq的核心参数3.1 镜像策略3.2 新镜像同步策略3.3 从节点晋升策略3.4 主队列选择策略 4. rabbitmq常用命令4.1 常用基础命令4.1.1 服务管理4.1.2 用户管理4.1.3 角色管理…

基于微信上海美食小程序系统设计与实现 研究背景和意义、国内外现状

博主介绍&#xff1a;黄菊华老师《Vue.js入门与商城开发实战》《微信小程序商城开发》图书作者&#xff0c;CSDN博客专家&#xff0c;在线教育专家&#xff0c;CSDN钻石讲师&#xff1b;专注大学生毕业设计教育和辅导。 所有项目都配有从入门到精通的基础知识视频课程&#xff…

DiskGenius v4.30专业版下载

DiskGenius是一款专业级的数据恢复软件&#xff0c;算法精湛、功能强大&#xff0c;用户群体广泛&#xff1b;支持各种情况下的文件恢复和分区恢复&#xff0c;恢复效果好&#xff1b;文件预览、扇区编辑、加密分区恢复、Ext4分区恢复、RAID恢复等高级功能应有尽有&#xff0c;…

Redis篇之分布式锁

一、为什么要使用分布式锁 1.抢劵场景 &#xff08;1&#xff09;代码及流程图 &#xff08;2&#xff09;抢劵执行的正常流程 就是正好线程1执行完整个操作&#xff0c;线程2再执行。 &#xff08;3&#xff09;抢劵执行的非正常流程 因为线程是交替进行的&#xff0c;所以有…

leetcode1079:游戏玩法分析——求留存率

求留存率 题目描述题解 题目描述 表&#xff1a;Activity --------------------- | Column Name | Type | --------------------- | player_id | int | | device_id | int | | event_date | date | | games_played | int | --------------------- &#xff08;player_id&…