当前位置: 首页 > news >正文

Git企业开发控制理论和实操-从入门到深入(六)|多人协作开发

前言

那么这里博主先安利一些干货满满的专栏了!

首先是博主的高质量博客的汇总,这个专栏里面的博客,都是博主最最用心写的一部分,干货满满,希望对大家有帮助。

  • 高质量博客汇总

然后就是博主最近最花时间的一个专栏《Git企业开发控制理论和实操》希望大家多多关注!

  • Git企业开发控制理论和实操

多人协作开发

学习案例一

案例说明

目标:在远端仓库中master分支下的file.txt文件新增两行代码aaabbb
实现:由开发者一新增aaa,由开发者二新增bbb
条件:在一个分支下协作完成。

准备工作

当然我们说过,远端的master分支一定是一个稳定的分支,不能用于开发。所以现在先在远端创建一个dev分支。

在这里插入图片描述
在这里插入图片描述

当然现在本地(云服务器)看不到远端的dev分支,所以先pull一下。

(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git pull 
From gitee.com:Yufch/remote-gitcode* [new branch]      dev        -> origin/dev
Already up-to-date.
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ 

现在本地就有远程的dev分支了。

注意:要区分本地的dev分支和本地所知道的远程的dev分支。

  • 本地的master分支叫做master

  • 远端的master在本地叫做origin/master

  • 远端的dev在本地叫做origin/dev

都是不一样的。

git branch -a # 可以查看本地的所有分支,包括本地的和远端的
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git branch -a
* masterremotes/origin/HEAD -> origin/masterremotes/origin/devremotes/origin/master
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$

然后上面把我的阿里云服务器上的仓库准备好了,我们再准备一个本地(maxOS本地)的一个remote仓库。

(base) [demac@YuMacBook-Air:Git企业开发精品课程]$ git clone https://gitee.com/Yufch/remote-gitcode.git
Cloning into 'remote-gitcode'...
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 17 (delta 3), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (17/17), 4.55 KiB | 4.55 MiB/s, done.
Resolving deltas: 100% (3/3), done.
(base) [demac@YuMacBook-Air:Git企业开发精品课程]$

开始开发

让协作者一完成aaa的更新,协作者二完成bbb的更新。

首先是开发者一:

看一下这行命令。

git checkout -b dev origin/dev

这行命令完成了三件事。

  • 在本地创建了一个dev分支
  • 切到dev分支下
  • 让本地的dev分支和远程的origin/dev分支建立了一个连接

如何查看这个连接呢?

git branch -vv
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git branch -vv
* dev    7393ea0 [origin/dev] add .gitignoremaster 7393ea0 [origin/master] add .gitignore
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$

新增一行aaa

在这里插入图片描述

然后add,commit,push到远程的dev分支中。

(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git add .
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git commit -m "md file.txt: aaa"
[dev 7c49864] md file.txt: aaa1 file changed, 2 insertions(+), 1 deletion(-)
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git status
# On branch dev
# Your branch is ahead of 'origin/dev' by 1 commit.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:git config --global push.default matchingTo squelch this message and adopt the new behavior now, use:git config --global push.default simpleSee 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 273 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To git@gitee.com:Yufch/remote-gitcode.git7393ea0..7c49864  dev -> dev
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$

然后是开发者二:

(base) [demac@YuMacBook-Air:remote-gitcode]$ ls
README.en.md    README.md       file.txt
(base) [demac@YuMacBook-Air:remote-gitcode]$ git branch
* master
(base) [demac@YuMacBook-Air:remote-gitcode]$ git checkout -b dev origin/dev
M       file.txt
branch 'dev' set up to track 'origin/dev'.
Switched to a new branch 'dev'
(base) [demac@YuMacBook-Air:remote-gitcode]$ git add .
(base) [demac@YuMacBook-Air:remote-gitcode]$ git commit -m "md file.txt: bbb"
[dev 220f739] md file.txt: bbbCommitter: 🐟的mac <demac@YuMacBook-Air.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:git config --global user.name "Your Name"git config --global user.email you@example.comAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 2 insertions(+), 1 deletion(-)
(base) [demac@YuMacBook-Air:remote-gitcode]$ git push
To https://gitee.com/Yufch/remote-gitcode.git! [rejected]        dev -> dev (fetch first)
error: failed to push some refs to 'https://gitee.com/Yufch/remote-gitcode.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
(base) [demac@YuMacBook-Air:remote-gitcode]$

我们发现,git拒绝了我们的推送。

这是因为,远程的dev分支下现在是有一行aaa的,而如果我们推送,就会冲突!

所以我们要先使用git pull把远程的东西先拉下来。

在这里插入图片描述

(base) [demac@YuMacBook-Air:remote-gitcode]$ git pull
Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
error: could not apply 220f739... md file.txt: bbb
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 220f739... md file.txt: bbb
(base) [demac@YuMacBook-Air:remote-gitcode]$ git add .
(base) [demac@YuMacBook-Air:remote-gitcode]$ git commit -m "merge"
[detached HEAD a37671a] mergeCommitter: 🐟的mac <demac@YuMacBook-Air.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:git config --global user.name "Your Name"git config --global user.email you@example.comAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 2 insertions(+), 1 deletion(-)
(base) [demac@YuMacBook-Air:remote-gitcode]$ git push
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, usegit push origin HEAD:<name-of-remote-branch>(base) [demac@YuMacBook-Air:remote-gitcode]$ git push origin HEAD:dev
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 292 bytes | 292.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/Yufch/remote-gitcode.git7c49864..a37671a  HEAD -> dev
(base) [demac@YuMacBook-Air:remote-gitcode]$ 

这样就可以了。

在这里插入图片描述

将origin/dev合并到origin/master中

PR方式

现在master分支是没有后面两行代码的。
在这里插入图片描述
要用pull request

在这里插入图片描述

提交PR之后,开发人员要做的事情就已经做完了。

审查人员通过看这个PR单子,文件改动这些信息,可以选择通过PR或拒绝PR。

在这里插入图片描述

本地合并dev再将本地master推送到origin/master上

学习案例二

案例说明

目标:远程master分支下新增funciton1和function2文件

实现:由开发者1新增function1,开发者2新增function2

条件:在不同分支下协作完成(各自私有一个分支)

开始开发

开发者一:

(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git branch -a
* devmasterremotes/origin/HEAD -> origin/masterremotes/origin/devremotes/origin/master
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git checkout -b feature-1
Switched to a new branch 'feature-1'
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ vim function-1
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git add .
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git commit -m "add function-1"
[feature-1 a34d9d6] add function-11 file changed, 2 insertions(+)create mode 100644 function-1
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git push origin feature-1 
Counting objects: 16, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (15/15), 1.93 KiB | 0 bytes/s, done.
Total 15 (delta 4), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
remote: Create a pull request for 'feature-1' on Gitee by visiting:
remote:     https://gitee.com/Yufch/remote-gitcode/pull/new/Yufch:feature-1...Yufch:master
To git@gitee.com:Yufch/remote-gitcode.git* [new branch]      feature-1 -> feature-1
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$

新增了一个function-1文件,然后直接推送到远程,远程就会多一个feature-1分支。

在这里插入图片描述

开发者二:

(base) [demac@YuMacBook-Air:remote-gitcode]$ cat file.txt
hello gitee
hello world
aaa
bbb
(base) [demac@YuMacBook-Air:remote-gitcode]$ ls
README.en.md    README.md       file.txt
(base) [demac@YuMacBook-Air:remote-gitcode]$ git checkout -b feature-2
Switched to a new branch 'feature-2'
(base) [demac@YuMacBook-Air:remote-gitcode]$ touch function-2
(base) [demac@YuMacBook-Air:remote-gitcode]$ vim function-2 
(base) [demac@YuMacBook-Air:remote-gitcode]$ cat function-2 n
I am coding ...
Done!
cat: n: No such file or directory
(base) [demac@YuMacBook-Air:remote-gitcode]$ cat function-2 
I am coding ...
Done!
(base) [demac@YuMacBook-Air:remote-gitcode]$ git add .
(base) [demac@YuMacBook-Air:remote-gitcode]$ git commit -m "add function-2"
[feature-2 2a63bd0] add function-2Committer: 🐟的mac <demac@YuMacBook-Air.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:git config --global user.name "Your Name"git config --global user.email you@example.comAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 2 insertions(+)create mode 100644 function-2
(base) [demac@YuMacBook-Air:remote-gitcode]$ git push origin feature-2
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 311 bytes | 311.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
remote: Create a pull request for 'feature-2' on Gitee by visiting:
remote:     https://gitee.com/Yufch/remote-gitcode/pull/new/Yufch:feature-2...Yufch:master
To https://gitee.com/Yufch/remote-gitcode.git* [new branch]      feature-2 -> feature-2
(base) [demac@YuMacBook-Air:remote-gitcode]$

在这里插入图片描述

此时目前到这里,我们没有发生任何冲突!

这是因为,他们是私有一个分支的,所以没有冲突。

但天有不测风云,你的小伙伴突然生病了,但需求还没开发完,需要你帮他继续开发,于是他便把feature-2 分支名告诉你了。这时你就需要在自己的机器上切换到 feature-2 分支帮忙继续开发。

这就回到了:多名开发者在一个机器上开发的情况了。

那么对于开发者一来说,我首先需要获得feature-2这个分支。

先pull下来。

(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git pull 
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
From gitee.com:Yufch/remote-gitcode* [new branch]      feature-2  -> origin/feature-27393ea0..ef7fda4  master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for detailsgit 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> feature-1(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git branch -adev
* feature-1masterremotes/origin/HEAD -> origin/masterremotes/origin/devremotes/origin/feature-1remotes/origin/feature-2remotes/origin/master
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$

虽然直接git pull会报错,但是我们看到,确实origin/feature-2分支能被本地看到了。

这是为什么?

git pull

  • 拉取分支内的内容(一定要建立连接后才能使用短的git pull命令)
  • 拉取仓库内容(可以直接拉,不需要分支建立连接,因为和分支本来就没关系)

此时,我们就要在本地创建一个feature-2分支,并和远程的origin/feature-2分支建立联系。·

(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git checkout -b feature-2 origin/feature-2
Branch feature-2 set up to track remote branch feature-2 from origin.
Switched to a new branch 'feature-2'
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git branchdevfeature-1
* feature-2master
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ 
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ vim function-2 
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git add .
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git commit -m "md function2 by 1"
[feature-2 280238d] md function2 by 11 file changed, 2 insertions(+)
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:git config --global push.default matchingTo squelch this message and adopt the new behavior now, use:git config --global push.default simpleSee 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 305 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To git@gitee.com:Yufch/remote-gitcode.git2a63bd0..280238d  feature-2 -> feature-2! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:Yufch/remote-gitcode.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration variable
hint: to 'simple', 'current' or 'upstream' to push only the current branch.
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$

此时远程就有了开发者一为开发者二写的内容了。

当然,如果此时开发者二说自己病好了,那么他想继续开发。

此时的开发者二是看不到开发者一新增的内容了,所以,pull一下即可。

开发者二:

(base) [demac@YuMacBook-Air:remote-gitcode]$ ls
README.en.md    README.md       file.txt        function-2
(base) [demac@YuMacBook-Air:remote-gitcode]$ # 先建立连接
(base) [demac@YuMacBook-Air:remote-gitcode]$ git branch --set-upstream-to=origin/feature-2 feature-2
branch 'feature-2' set up to track 'origin/feature-2'.
(base) [demac@YuMacBook-Air:remote-gitcode]$ git branch -vvdev       220f739 [origin/dev: ahead 1, behind 2] md file.txt: bbb
* feature-2 2a63bd0 [origin/feature-2] add function-2master    ef7fda4 [origin/master] !1 dev请求合并到master Merge pull request !1 from Yufc/dev
(base) [demac@YuMacBook-Air:remote-gitcode]$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 285 bytes | 95.00 KiB/s, done.
From https://gitee.com/Yufch/remote-gitcode2a63bd0..280238d  feature-2  -> origin/feature-2
Updating 2a63bd0..280238d
Fast-forwardfunction-2 | 2 ++1 file changed, 2 insertions(+)
(base) [demac@YuMacBook-Air:remote-gitcode]$ 

开发好之后push上去就行了。

origin/feature-2和origin/feature-1合并到origin/master上去

这里我们用PR的方式。

在这里插入图片描述

最后把feature-2也提交一份PR。

然后就等审查人员通过PR即可。

在这里插入图片描述

当然,按照之前的建议,我们其实不能像上面那样去合并。

要先让feature-2去合并master,如果有bug,也不会影响master,大家可以参考之前的章节。

解决git branch -a显示已经被删除的远程分支的方法

就是,开发完成之后,远程删除feature-1和feature-2这两个分支了。

但是git branch -a在本地还是能够显示feature-1和feature-2这两个分支,这是不好的。

在这里插入图片描述

git remote show origin

这个命令可以看到远程的一些信息。

(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git remote show origin
* remote originFetch URL: git@gitee.com:Yufch/remote-gitcode.gitPush  URL: git@gitee.com:Yufch/remote-gitcode.gitHEAD branch: masterRemote branches:feature-1               trackedfeature-2               trackedmaster                  trackedrefs/remotes/origin/dev stale (use 'git remote prune' to remove) # 他这里会建议我们去删除这些分支Local branches configured for 'git pull':dev       merges with remote devfeature-2 merges with remote feature-2master    merges with remote masterLocal refs configured for 'git push':feature-1 pushes to feature-1 (up to date)feature-2 pushes to feature-2 (local out of date)master    pushes to master    (local out of date)
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ 
git remote prune origin # 这个命令可以去修剪一些已经被删除的分支
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$ git remote prune origin
Pruning origin
URL: git@gitee.com:Yufch/remote-gitcode.git* [pruned] origin/dev
(base) [yufc@ALiCentos7:~/Src/Bit-Courses/GitDevelopment/remote-gitcode]$

这里显示已经帮我们删除了dev分支了。

相关文章:

Git企业开发控制理论和实操-从入门到深入(六)|多人协作开发

前言 那么这里博主先安利一些干货满满的专栏了&#xff01; 首先是博主的高质量博客的汇总&#xff0c;这个专栏里面的博客&#xff0c;都是博主最最用心写的一部分&#xff0c;干货满满&#xff0c;希望对大家有帮助。 高质量博客汇总 然后就是博主最近最花时间的一个专栏…...

通过 ChatGPT 学习 Python

先决条件 您需要一个 OpenAI 帐户才能开始与 ChatGPT 交互。如果您还没有这样做,请在 OpenAI 网站上注册一个帐户。 什么是 ChatGPT? GPT(Generative Pre-training Transformer)是 OpenAI 开发的一种语言模型,它使用深度学习技术生成类似人类的文本。ChatGPT 是 GPT 模…...

开发卡牌gamefi游戏需要多少钱?

卡牌游戏作为一种受欢迎的游戏形式&#xff0c;吸引了众多开发者的关注。然而&#xff0c;开发一款成功的卡牌游戏需要全面考虑多个方面的因素&#xff0c;其中之一就是资金投入。本文将从专业性和投入回报的角度&#xff0c;探讨开发一款卡牌游戏所需的资金投入。 一、专业性的…...

linux服务TCP参数配置

Linux TCP参数配置 阿里云规范 1.【推荐】高并发服务器建议调小 TCP 协议的 time_wait 超时时间。 说明&#xff1a;操作系统默认 240 秒后&#xff0c;才会关闭处于 time_wait 状态的连接&#xff0c;在高并发访问下&#xff0c;服务器端会因为处于 time_wait 的连接数太多&am…...

部署Spring Boot项目

上传jar包 之前在新建Spring Boot项目[1]使用mvn install的方式&#xff0c;已经构建出jar包。 通过scp或rz/sz&#xff0c;将该jar包上传到服务器 执行java -jar hello-0.0.1-SNAPSHOT.jar,发生如下报错&#xff1a; Exception in thread "main" java.lang.Unsuppo…...

Java 中数据结构LinkedList的用法

LinkList 链表&#xff08;Linked list&#xff09;是一种常见的基础数据结构&#xff0c;是一种线性表&#xff0c;但是并不会按线性的顺序存储数据&#xff0c;而是在每一个节点里存到下一个节点的地址。 链表可分为单向链表和双向链表。 一个单向链表包含两个值: 当前节点…...

jmeter递增压测线程组配置

jmeter递增压测线程组配置 新建线程组线程组参数详解及填写其他指标设置 新建线程组 操作位置如图&#xff1a; 线程组参数详解及填写 其他指标设置 其他指标设置可参考另一篇文章&#xff1a; 链接: jmeter 在linux服务器中执行性能测试、监听服务器资源指标...

hutool工具

Hutool是一个Java工具包 参考&#xff1a;https://www.hutool.cn/ <dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>4.6.3</version> </dependency>Convert类型转换工具类 //转换为…...

Redis.conf 配置文件详解

1、units 单位 配置大小单位&#xff0c;开头定义了一些基本的度量单位&#xff0c;只支持 bytes&#xff0c;不支持bit&#xff0c;并且对大小写 不敏感。 2、INCLUDES 包含 类似于 Spring 配置文件&#xff0c;可以通过 includes 包含&#xff0c;redis.conf 可以作为总文件…...

linux磁盘空间满了

登录服务器&#xff0c;通过df -Hl查看 确定告警信息一致&#xff0c;接着是找到占用空间大目录或文件 一种比较笨的方法是&#xff0c;在根目录下&#xff0c;通过du -sh命令&#xff0c;列出各目录所占空间大小 之后再用同样的方法继续到对应目录下去找 再相对高效一点的…...

Ansible项目实战管理/了解项目环境/项目管理

一&#xff0c;项目环境 1.项目基础 项目过程 调研阶段 设计阶段 开发阶段 测试阶段 运营阶段 2.项目环境 个人开发环境 公司开发环境 项目测试环境 项目预发布环境 灰度环境&#xff1a;本身是生产环境&#xff0c;安装项目规划&#xff0c;最终所有的生产环境都发…...

hadoop 学习:mapreduce 入门案例一:WordCount 统计一个文本中单词的个数

一 需求 这个案例的需求很简单 现在这里有一个文本wordcount.txt&#xff0c;内容如下 现要求你使用 mapreduce 框架统计每个单词的出现个数 这样一个案例虽然简单但可以让新学习大数据的同学熟悉 mapreduce 框架 二 准备工作 &#xff08;1&#xff09;创建一个 maven 工…...

vue2项目中el-input单独使用max和maxlength不生效问题

vue2项目中el-input单独使用max和maxlength不生效问题 今天在vue2的项目中使用element中的<el-input>组件&#xff0c;因为没有使用form所以max和maxlength属性没有生效&#xff0c;下面是解决办法 <el-input placeholder"请输入" v-model"holeDat…...

源码角度看待线程池的执行流程

文章目录 前言一、线程池的相关接口和实现类1.Executor接口2.ExecutorService接口3.AbstractExecutorService接口4.ThreadPoolExecutor 实现类 二、ThreadPoolExecutor源码解析1.Worker内部类2.execute()方法3.addWorker()方法 总结 前言 线程池内部维护了若干个线程&#xff…...

我们的第一个 Qt 窗口程序

Qt 入门实战教程&#xff08;目录&#xff09; Windows Qt 5.12.10下载与安装 为何使用Qt Creator开发QT 本文介绍用Qt自带的集成开发工具Qt Creator创建Qt默认的窗口程序。 本文不需要你另外安装Visual Studio 2022这样的集成开发环境&#xff0c;也不需要你再在Visual St…...

Linux 8 下的容器引擎Podman概述

一、前言 最近在进行OS国产化交流中&#xff0c;了解到部分业务迁移到BClinux 8.2或Anolis 8.2时&#xff0c;原有docker业务需要迁移到新的容器平台&#xff1a;Podman&#xff0c;来完成容器的新的管理。Podman&#xff08;全称 Pod Manager&#xff09;是一款用于在 Linux 系…...

C++编辑修改PDF

PDFWriter是一个易于使用的C创建、修改PDF文档的库 1.创建一个PDF文件 #include #include “PDFWriter.h” int main() { std::cout << “Hello World!\n”; PDFWriter pdfWriter; int retpdfWriter.StartPDF(“D:\mytestwriterpdf.pdf”, ePDFVersion13); if (ret eS…...

数据倾斜优化

数据倾斜发生的原因有哪些&#xff1f; map输出数据按key Hash的分配到reduce中&#xff0c;由于key分布不均匀、业务数据本身的特性、建表时考虑不周等原因造成的reduce 上的数据量差异过大。 数据倾斜解决方式有哪些 group by 导致的数据倾斜 1.开启Map-Side聚合后&#x…...

Acwing796.子矩阵的和

理解二维前缀和&#xff1a; #include <iostream>using namespace std;const int N 1010;int a[N][N], s[N][N];int main() {int n, m, q;cin >> n >> m >> q;for (int i 1; i < n; i)for (int j 1; j < m; j) {scanf("%d", &a…...

【ELK日志收集系统】

目录 一、概述 1.作用 2.为什么使用&#xff1f; 二、组件 1.elasticsearch 1.1 作用 1.2 特点 2.logstash 2.1 作用 2.2 工作过程 2.3 INPUT 2.4 FILETER 2.5 OUTPUTS 3.kibana 三、架构类型 1.ELK 2.ELKK 3.ELFK 4.ELFKK 四、案例 - 构建ELK集群 1.环境…...

突破性解决方案:3步解决Calibre中文路径乱码,实现100%原生中文支持

突破性解决方案&#xff1a;3步解决Calibre中文路径乱码&#xff0c;实现100%原生中文支持 【免费下载链接】calibre-do-not-translate-my-path Switch my calibre library from ascii path to plain Unicode path. 将我的书库从拼音目录切换至非纯英文&#xff08;中文&#x…...

探索Unity全功能的开源方案:UniHacker跨平台功能扩展工具深度指南

探索Unity全功能的开源方案&#xff1a;UniHacker跨平台功能扩展工具深度指南 【免费下载链接】UniHacker 为Windows、MacOS、Linux和Docker修补所有版本的Unity3D和UnityHub 项目地址: https://gitcode.com/GitHub_Trending/un/UniHacker Unity作为游戏开发领域的行业标…...

PFC颗粒流代码模拟岩石预制裂隙与完整岩石单轴压缩对比分析

PFC颗粒流代码 pfc离散元岩石预制裂隙&#xff0c;裂隙岩石与完整岩石单轴压缩代码&#xff0c;可出各种裂隙形式&#xff0c;可分析应力应变曲线图&#xff0c;裂隙发育与数量&#xff0c;能量变化&#xff0c;简易声发射分析等做岩石单轴压缩离散元模拟的&#xff0c;谁没为…...

新书推荐:《尊严的颓败》在废墟之上,寻找灵魂的微光

当世界沦为巨大的名利场&#xff0c;当人被简化为数据与欲望的载体&#xff0c;我们该如何定义“人”&#xff1f;又该如何安放那颗被称为“灵魂”的种子&#xff1f;洛本的《尊严的颓败》并非一本让人阅读时感到轻松愉悦的书&#xff0c;它更像是一把手术刀&#xff0c;精准地…...

python-flask-djangol框架的关爱空巢老人和孩子留守儿童管理系统的设计和实现

目录需求分析与规划技术选型核心模块设计数据安全与权限开发与测试计划社区与可持续性项目技术支持源码获取详细视频演示 &#xff1a;文章底部获取博主联系方式&#xff01;同行可合作需求分析与规划 明确系统核心功能模块&#xff1a;空巢老人健康监测、留守儿童学习与心理辅…...

SaaS级AI员工系统源码商用版,多租户+计费系统+API分销,一套源码搞定

温馨提示&#xff1a;文末有资源获取方式最近“龙虾AI”的热度居高不下&#xff0c;到处都在讨论如何“养龙虾”。但观察下来发现&#xff0c;这类应用对普通用户而言技术门槛还是偏高&#xff0c;部署、配置、调试都需要专人跟进&#xff0c;最终往往沦为摆设。源码获取方式在…...

避开这5个坑!用HipSTR分析NGS数据时最容易出错的STR检测问题

避开这5个坑&#xff01;用HipSTR分析NGS数据时最容易出错的STR检测问题 STR检测在二代测序数据分析中扮演着关键角色&#xff0c;但实际操作中常会遇到各种"坑"。本文将结合实战经验&#xff0c;剖析使用HipSTR进行STR检测时最容易出错的五个关键环节&#xff0c;帮…...

如何用stressapptest进行高效内存和磁盘压力测试?实战案例分享

如何用stressapptest进行高效内存和磁盘压力测试&#xff1f;实战案例分享 在服务器运维和硬件性能评估中&#xff0c;内存和磁盘的稳定性直接关系到系统的可靠性。想象一下&#xff0c;当你的服务器在凌晨三点突然因为内存错误崩溃&#xff0c;或者磁盘在高峰期出现读写异常&a…...

别再死记硬背Sarsa公式了!用Python手搓一个‘胆小’的迷宫探索AI(附完整代码)

用Python打造胆小如鼠的迷宫AI&#xff1a;Sarsa算法实战图解 当你在迷宫中小心翼翼地贴着墙走&#xff0c;生怕掉进陷阱时——恭喜&#xff0c;你已经理解了Sarsa算法的核心思想。今天我们不谈枯燥的数学公式&#xff0c;而是用Python构建一个会"瑟瑟发抖"的迷宫探索…...

别再纠结了!用SpringBoot实战告诉你,图片上传选FastDFS还是MinIO(附完整代码)

SpringBoot实战&#xff1a;FastDFS与MinIO文件存储方案深度对比与选型指南 在当今数据驱动的互联网应用中&#xff0c;文件存储系统如同数字世界的基础设施&#xff0c;支撑着从用户头像到高清视频的各种数据存取需求。作为Java开发者&#xff0c;当我们面对"选择困难症&…...