【Git】git命令(全)

news2024/11/15 3:30:15

Git

  • 1、本地操作
  • 2、版本管理
  • 3、远端仓库
  • 4、分支管理
  • 5、缓存stash
  • 6、遗留rebase
  • 7、标签管理
  • 8、解决冲突
  • 9、参考教程
  • 10、示例代码

在这里插入图片描述

1、本地操作

  • Linux安装git:yum install git
  • 查看git版本 git version
  • 查看git设置 git config --list
  • 设置git属性 git config --global
  • 初始化git仓库:git init
  • 初始化git用户邮箱:git config --global user.email “rice_van@email.com”
  • 初始化git用户姓名:git config --global user.name “rice_van”
  • 添加到仓库:git add filename.txt
  • 提交到仓库:git commit -m “change messages”
  • 查看仓库状态:git status
  • 查看工作区修改区别:git diff
  • 查看工作区文件区别:git diff HEAD – filename.txt
  • 查看版本记录:git log
  • 查看简洁记录:git log --pretty=oneline
  • 查看命令记录:git reflog

2、版本管理

版本库提交流程:

  • 第一步是用git add把文件添加进去,实际上就是把文件修改添加到暂存区;
  • 第二步是用git commit提交更改,实际上就是把暂存区的所有内容提交到当前分支。
    在这里插入图片描述
  • 每次修改,如果不用git add到暂存区,那就不会加入到commit中
  • 第一次修改 -> git add -> 第二次修改 -> git add -> git commit
  • HEAD表示当前版本
  • HEAD^表示上一版本,上上版本HEAD^^
  • 前100次版本HEAD~100
    在这里插入图片描述
  • 回退最新提交:git reset --hard HEAD^ (即回到此版本的前一版本)
  • 回到指定版本:git reset --hard commit_id
  • 撤销暂存区修改,修改内容放回到工作区:git rest HEAD filename.txt
  • 撤销工作区修改:git checkout -- filename.txt
  • 回退本地误删文件:git checkout --filename.txt
  • 删除仓库文件:
    git rm filename.txt
    git commit -m “remove filename.txt”

3、远端仓库

  • 生成ssh秘钥:ssh-keygen -t rsa -C “xxxxxx@email.com”
  • 克隆远端仓库到本地:git clone git@github.com:xxxxx/learngit.git
  • 本地关联远程仓库:git remote add origin git@gitee.com:xxxxx/learngit.git
  • 查看远端仓库:git remote
  • 查看远程仓库信息:git remote -v
  • 删除远端关联关系:git remote rm origin
  • 本地修改推送远程仓库:git push origin master
  • 本地修改推送远程仓库:git push -u origin master
  • 推送到远端指定分支:git push origin originbranchname
  • 抓取远程分支到本地:git checkout -b branchname origin/branchname
  • 设置本地分支对应到远端指定分支:git branch --set-upstream-to=origin/branchname branchname
  • 本地分支与远端分支名不同时:git push origin HEAD:branchname (远端名)

尽量保持本地分支名与远端分支名一致

4、分支管理

  • 查看所有分支:git branch
  • 创建分支:git branch branchname
  • 删除分支:git branch -d branchname
  • 强行删除为合并分支:git branch -D branchname
  • 切换分支:git swtich branchname
  • 创建并切换分支:git swtich -c branchname
  • 合并到指定分支到当前分支:git merge branchname
  • 禁用Fast Forward方式合并:git merge --no-ff -m “messages” branchname (删除分支后可看合并历史)
  • 查看分支合并图:git log --graph
  • 查看分支合并图简易:git log --graph --pretty=oneline --abbrev-commit
  • 复制commit到当前分支:git cherry-pick commitid

5、缓存stash

  • 缓存修改:git stash
  • 缓存并标记:git stash -m “issue-01-2023.03.20:57”
  • 缓存列表:git stash list
  • 应用缓存:git stash apply
  • 删除缓存:git stash drop
  • 应用并删除:git stash pop
  • 应用某一缓存:git stash apply stash@{4}

6、遗留rebase

7、标签管理

  • 标签作用:标记commit,快速查看重要提交节点
  • 添加标签默认添加到当前分支的最新commit:git tag v1.0
  • 添加标签到指定commit:git tag v2.0 commitid
  • 添加标签与说明信息:git tag -a v3.0 -m “version 3.0 released”
  • 查看所有标签:git tag
  • 查看详细标签:git show v2.0
  • 删除标签:git tag -d v3.0
  • 推送标签到远程:git push origin v1.0
  • 推送所有标签:git push origin --tags
  • 删除远端标签:
    git tag -d v1.0
    git push origin :refs/tags/v1.0

8、解决冲突

  • 更新本地代码:git pull
  • 查看状态:git status
  • 手动修改,删除冲突内容
  • 重新提交:git add 、 git commit

9、参考教程

廖雪峰Git教程
Gitee教程

10、示例代码

[root@ecs-xxx ~]# git
-bash: git: command not found
[root@ecs-xxx ~]# 
[root@ecs-xxx ~]# sudo apt-get install git
sudo: apt-get: command not found
[root@ecs-xxx ~]# 
[root@ecs-xxx ~]# yum install git
Loaded plugins: fastestmirror
Complete!
[root@ecs-xxx ~]# git version
git version 1.8.3.1
[root@ecs-xxx ~]# whereis git
git: /usr/bin/git /usr/share/man/man1/git.1.gz
[root@ecs-xxx ~]# pwd
/root
[root@ecs-xxx /]# cd home
[root@ecs-xxx home]# mkdir learngit
[root@ecs-xxx home]# cd learngit
[root@ecs-xxx learngit]# pwd
/home/learngit
[root@ecs-xxx learngit]# git init
Initialized empty Git repository in /home/learngit/.git/
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# ls -a
.  ..  .git
[root@ecs-xxx learngit]# touch readme.txt
[root@ecs-xxx learngit]# ls
readme.txt
[root@ecs-xxx learngit]# vim readme.txt 
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
[root@ecs-xxx learngit]# git add readme.txt 
[root@ecs-xxx learngit]# git commit -m 'wrote a readme file.'

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@ecs-xxx.(none)')
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git config --global user.email "xxxxxx@email.com"
[root@ecs-xxx learngit]# git config --global user.name "xxxxxx"
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git config --list
user.email=xxxxxx@email.com
user.name=xxxxx
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@gitee.com:xxxxx/learngit.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git commit -m 'wrote a readme file.'
[master (root-commit) af264a5] wrote a readme file.
 1 file changed, 2 insertions(+)
 create mode 100644 readme.txt
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# cat readme.txt
Git is a version control system.
xf
[root@ecs-xxx learngit]# vim readme.txt 
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   readme.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git diff
diff --git a/readme.txt b/readme.txt
index 1a0762b..68fe139 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,2 +1,3 @@
 Git is a version control system.
 xf
+Git is free software.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git add readme.txt 
[root@ecs-xxx learngit]# git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   readme.txt
#
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git commit -m "add new line"
[master 910aa81] add new line
 1 file changed, 1 insertion(+)
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git status
# On branch master
nothing to commit, working directory clean
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]#
[root@ecs-xxx learngit]# vim readme.txt 
[root@ecs-xxx learngit]# git add readme.txt 
[root@ecs-xxx learngit]# git commit -m "add system time"
[master 331832a] add system time
 1 file changed, 1 insertion(+)
[root@ecs-xxx learngit]# git status
# On branch master
nothing to commit, working directory clean
[root@ecs-xxx learngit]#
[root@ecs-xxx learngit]# git log
commit af264a5ada2e059ad822d7121fa2e595129198de
Author: xxxxxx <xxxxxx@email.com>
Date:   Thu Mar 2 10:01:05 2023 +0800

:
Date:   Thu Mar 2 10:06:21 2023 +0800

    add system time

commit 910aa81c9bade65244b9ba43a74f225dc931f22e
Author: xxxxxx <xxxxxx@email.com>
Date:   Thu Mar 2 10:03:55 2023 +0800

    add new line

commit af264a5ada2e059ad822d7121fa2e595129198de
Author: xxxxxx <xxxxxx@email.com>
Date:   Thu Mar 2 10:01:05 2023 +0800

    wrote a readme file.
[1]+  Stopped                 git log
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git log --pretty=oneline
331832aa56734d0f34517fd246ceb32b32ed20a2 add system time
910aa81c9bade65244b9ba43a74f225dc931f22e add new line
af264a5ada2e059ad822d7121fa2e595129198de wrote a readme file.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git reset --hard HEAD^
HEAD is now at 910aa81 add new line
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
Git is free software.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git log
commit 910aa81c9bade65244b9ba43a74f225dc931f22e
Author: xxxxxx <xxxxxx@email.com>
Date:   Thu Mar 2 10:03:55 2023 +0800

    add new line

commit af264a5ada2e059ad822d7121fa2e595129198de
Author: xxxxxx <xxxxxx@email.com>
Date:   Thu Mar 2 10:01:05 2023 +0800

    wrote a readme file.
[root@ecs-xxx learngit]# 


[root@ecs-xxx learngit]# touch license.txt
[root@ecs-xxx learngit]# vim license.txt 
[root@ecs-xxx learngit]# git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	license.txt
nothing added to commit but untracked files present (use "git add" to track)
[root@ecs-xxx learngit]# vim readme.txt 
[root@ecs-xxx learngit]# cat readme.txt
Git is a version control system.
xf
Git is free software.
2023/3/2
Git has a mutable index called stage.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   readme.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	license.txt
no changes added to commit (use "git add" and/or "git commit -a")
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git add readme.txt 
[root@ecs-xxx learngit]# git add license.txt 
[root@ecs-xxx learngit]# git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   license.txt
#	modified:   readme.txt
#
[root@ecs-xxx learngit]# git commit -m "add new file license.txt"
[master 40b3936] add new file license.txt
 2 files changed, 2 insertions(+)
 create mode 100644 license.txt
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git status
# On branch master
nothing to commit, working directory clean
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
Git is free software.
2023/3/2
Git has a mutable index called stage.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# vi readme.txt 
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
Git is free software.
2023/3/2
Git has a mutable index called stage.
My stupid boss.
[root@ecs-xxx learngit]# git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   readme.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git checkout -- readme.txt 
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
Git is free software.
2023/3/2
Git has a mutable index called stage.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# vi readme.txt 
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
Git is free software.
2023/3/2
Git has a mutable index called stage.
Fuck!!
[root@ecs-xxx learngit]# git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   readme.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git add readme.txt 
[root@ecs-xxx learngit]# git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   readme.txt
#
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git reset HEAD readme.txt 
Unstaged changes after reset:
M	readme.txt
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
Git is free software.
2023/3/2
Git has a mutable index called stage.
Fuck!!
[root@ecs-xxx learngit]# git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   readme.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git checkout -- readme.txt 
[root@ecs-xxx learngit]# git status
# On branch master
nothing to commit, working directory clean
[root@ecs-xxx learngit]# cat readme.txt 
Git is a version control system.
xf
Git is free software.
2023/3/2
Git has a mutable index called stage.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# touch test.txt
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	test.txt
nothing added to commit but untracked files present (use "git add" to track)
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git add test.txt 
[root@ecs-xxx learngit]# git commit -m "add test.txt"
[master cd18992] add test.txt
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
[root@ecs-xxx learngit]# git status
# On branch master
nothing to commit, working directory clean
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# rm test.txt 
rm: remove regular empty file ‘test.txt’? y
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# ls
license.txt  readme.txt
[root@ecs-xxx learngit]# git status
# On branch master
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	deleted:    test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
[root@ecs-xxx learngit]# git checkout -- test.txt
[root@ecs-xxx learngit]# ls
license.txt  readme.txt  test.txt
[root@ecs-xxx learngit]# 
[root@ecs-fjx learngit]# 
[root@ecs-fjx learngit]# git reflog
6aca85e HEAD@{0}: rebase finished: returning to refs/heads/master
6aca85e HEAD@{1}: pull --rebase origin master: add test.txt
1149b68 HEAD@{2}: pull --rebase origin master: add new file license.txt
283dd5f HEAD@{3}: pull --rebase origin master: add system time
92808ba HEAD@{4}: pull --rebase origin master: add new line
2b29c43 HEAD@{5}: pull --rebase origin master: wrote a readme file.
58bbad5 HEAD@{6}: checkout: moving from master to 58bbad55beedbb8e07a334b18dcf0694ab6fa291^0
cd18992 HEAD@{7}: commit: add test.txt
40b3936 HEAD@{8}: commit: add new file license.txt
331832a HEAD@{9}: reset: moving to 331832
910aa81 HEAD@{10}: reset: moving to HEAD^
331832a HEAD@{11}: commit: add system time
910aa81 HEAD@{12}: commit: add new line
af264a5 HEAD@{13}: commit (initial): wrote a readme file.
[root@ecs-fjx learngit]# 







[root@ecs-xxx ~]# ssh-keygen -t rsa -C "xxxxxx@email.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX email@email.com
The key's randomart image is:
+---[RSA 2048]----+

+----[SHA256]-----+
[root@ecs-xxx ~]# 
[root@ecs-xxx ~]# ls -a
.   .bash_history  .bash_profile  .cshrc      .history           .pki  .tcshrc
..  .bash_logout   .bashrc        .gitconfig  mirrors_source.sh  .ssh  .viminfo
[root@ecs-xxx ~]# cd .ssh
[root@ecs-xxx .ssh]# ls 
authorized_keys  id_rsa  id_rsa.pub
[root@ecs-xxx .ssh]# cat id_rsa.pub 
[root@ecs-xxx learngit]# git remote add origin git@gitee.com:xxxxx/learngit.git
[root@ecs-xxx learngit]# git remote -v
origin	git@gitee.com:xxxxx/learngit.git (fetch)
origin	git@gitee.com:xxxxx/learngit.git (push)
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git status
# On branch master
nothing to commit, working directory clean
[root@ecs-xxx learngit]# 


[root@ecs-xxx learngit]# git pull
warning: no common commits
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From gitee.com:xxxxx/learngit
 * [new branch]      develop    -> origin/develop
 * [new branch]      feature    -> origin/feature
 * [new branch]      master     -> origin/master
 * [new branch]      release    -> origin/release
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> master

[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# ls 
license.txt  readme.txt  test.txt
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git push -u origin master
Warning: Permanently added the ECDSA host key for IP address '212.64.63.190' to the list of known hosts.
To git@gitee.com:xxxxx/learngit.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:xxxxx/learngit.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git pull --reabse origin master
error: unknown option `reabse'
usage: git fetch [<options>] [<repository> [<refspec>...]]
   or: git fetch [<options>] <group>
   or: git fetch --multiple [<options>] [(<repository> | <group>)...]
   or: git fetch --all [<options>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --all                 fetch from all remotes
    -a, --append          append to .git/FETCH_HEAD instead of overwriting
    --upload-pack <path>  path to upload pack on remote end
    -f, --force           force overwrite of local branch
    -m, --multiple        fetch from multiple remotes
    -t, --tags            fetch all tags and associated objects
    -n                    do not fetch all tags (--no-tags)
    -p, --prune           prune remote-tracking branches no longer on remote
    --recurse-submodules[=<on-demand>]
                          control recursive fetching of submodules
    --dry-run             dry run
    -k, --keep            keep downloaded pack
    -u, --update-head-ok  allow updating of HEAD ref
    --progress            force progress reporting
    --depth <depth>       deepen history of shallow clone
    --unshallow           convert to a complete repository


[root@ecs-xxx learngit]# git pull --rebase origin master
From gitee.com:xxxxx/learngit
 * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: wrote a readme file.
Applying: add new line
Applying: add system time
Applying: add new file license.txt
Applying: add test.txt
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# ls 
license.txt  README.en.md  README.md  readme.txt  test.txt
[root@ecs-xxx learngit]# 
[root@ecs-xxx learngit]# git push -u origin master
Counting objects: 17, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (16/16), 1.32 KiB | 0 bytes/s, done.
Total 16 (delta 6), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To git@gitee.com:xxxxx/learngit.git
   58bbad5..6aca85e  master -> master
Branch master set up to track remote branch master from origin.
[root@ecs-xxx learngit]# 


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

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

相关文章

鲁班软件使用明道云优化项目管理的全过程

一、关于鲁班软件 鲁班软件成立于2001年&#xff0c;是推动中国建筑业走进工程量电算化时代的开拓者&#xff1b;同时给最近很火的元宇宙提供了关键数字工具&#xff0c;推动智慧城市、智慧楼宇、数字中国建设&#xff0c;工具包括鲁班工程管理数字平台和鲁班BIM/CIM开发者平台…

第三章 集成jest做单元测试环境

1 集成jest做单元测试环境 首先附上项目目录的截图 接着就是搭建项目的大体流程&#xff1a; 1 通过yarn init -y生成package.json文件夹&#xff0c;并且在script中添加运行程序的命令代码&#xff0c;如图 2 创建src&#xff0c;reactivity&#xff0c;tests文件夹&#xf…

C语言--模拟实现库函数qsort

什么是qsort qsort是一个库函数&#xff0c;是用来排序的库函数&#xff0c;使用的是快速排序的方法(quicksort)。 qsort的好处在于&#xff1a; 1&#xff0c;现成的 2&#xff0c;可以排序任意类型的数据。 在之前我们已经学过一种排序方法&#xff1a;冒泡排序。排序的原理…

设置CentOS7的时间与网络同步

1.设置时区为北京时间 [rootlocalhost ~]# timedatectl set-timezone Asia/Shanghai 2.查看系统时间 [rootlocalhost ~]# timedatectl Local time: 四 2023-03-02 17:40:41 CST #系统时间 Universal time: 四 2023-03-02 09:40:41 UTC …

安卓APK打包流程浅析

在面试中&#xff0c;大公司会问你......APK打包流程全过程&#xff1f;APK签名在实际业务中能处理什么&#xff1f;APK加固原理是如何实现的&#xff0c;怎么保证安全&#xff1f;APK签名V1,V2,V3的区别于原理&#xff0c;有什么漏洞&#xff1f;这里只讲解打包流程的全过程。…

Phind-面向程序员的AI聊天对话机器人

ChatGPT在国内没开放&#xff0c;很多人注册不了。导致了很多人走illegal渠道获取账号密码。这样是不对的。 今天介绍一款面向程序员的ai聊天机器人Phind&#xff0c;ta目前可以不用注册直接使用、免费、也不用梯子。 &#xff08;且用且珍惜&#xff0c;不知道之后会不会跟Cop…

Makefile的使用

Makefile的使用 自动化编译脚本&#xff0c;这个东西就是&#xff0c;进行简单的设置&#xff0c;然后实现原码编成为相应程序&#xff0c;简单化自己进行相关操作的过程。不需要一个个自己进行全部进行输入。而且还有许多的简化书写方法。 ​ 这个Makefile的本质为一种脚本语言…

SYSU程设c++(第二周) string、函数重载、constexpr、auto

创建string对象&#xff1a; string s1; // s1 未使用初始化参数&#xff0c;即默认初始化为空字符串 string s2 "c" ; //不是赋值运算&#xff0c;它等价于 string s2("c") ,是初始化 string s3 (5, s); // s4 初始化为 5 个 s&#xff1b; string…

可视化图表之奥妙——百分比堆叠柱状图

百分比堆叠柱状图是属于堆叠柱状图的一种&#xff0c;是指将每个柱子进行分割以显示相同类型下各个数据的占比大小情况。百分比堆叠柱形图上柱子的各个层代表的是该类别数据占该分组总体数据的百分比&#xff0c;但不适用于对比不同分组内同个分类的数据大小或者对比各分组总数…

企业邮箱对企业有哪些好处以及便捷性

企业邮箱拥有更专业的办公功能&#xff0c;更适合职场使用。同时&#xff0c;使用企业邮箱还可以帮助企业“公私分明”。一方面保护了公司信息&#xff0c;另一方面也提高了工作效率。加上公司统一邮箱也有助于提升公司形象。使用企业邮箱除了收发邮件方便外&#xff0c;还可以…

MyBatis——配置文件完成增删改查

1.首先先创建一个新的表,使用下面的sql语句 -- 删除tb_brand表 drop table if exists tb_brand; -- 创建tb_brand表 create table tb_brand (-- id 主键id int primary key auto_increment,-- 品牌名称brand_name varchar(20),-- 企业名称company_name varchar(20…

openpnp - configure - 丢弃(Discard)位置的设置

文章目录openpnp - configure - 丢弃(Discard)位置的设置概述笔记设置丢弃位置吸取元件失败后, 吸嘴一直吸气的处理ENDopenpnp - configure - 丢弃(Discard)位置的设置 概述 测试时, 吸取了一个元件, 吸取成功了, 现在想将这个料丢掉. 点击控制面板-Special页中的Discard不好…

WSN_1 介绍;部分应用介绍

学习自书籍&#xff1a;Fundamentals of Wireless Sensor Networks. WSN 介绍 传感器 从基础角度说&#xff0c;传感器观测采集现实世界的一些数据。 另一个名称是 transducer 换能器&#xff0c;指传感器将一些形式的信号转换为其他形式的信号&#xff0c;如光敏传感器 光…

华为OD机试用Python实现 -【集五福】 |老题且简单

华为OD机试题 最近更新的博客华为 OD 机试 300 题大纲集五福题目描述输入描述输出描述示例一输入输出示例二输入输出代码编写思路Python 代码最近更新的博客 华为od 2023 | 什么是华为od,od 薪资待遇,od机试题清单华为OD机试真题大全,用 Python 解华为机试题 | 机试宝典

进程和线程理论知识

1.进程和线程之间的联系。 进程是程序依次执行的过程&#xff0c;线程是比进程小的执行单位。 一个进程在其执行过程中可以创建多个线程。 多个线程共享进程的堆和方法区内存资源。 进程是OS进行资源分配的基本单位。 线程是OS进行调度的基本单位。 进程和线程是1&#xff1…

GPU编程实战1

给一张测试图&#xff0c;对测试图分别cpu和GPU进行处理&#xff0c;进行时间统计&#xff0c;最后做展示。 环境&#xff1a;win10 cuda11.3 python3.7 numba 等 硬件&#xff1a;cpu:i59400 ,gpu:RTX1650 4G 首先进行cuda安装&#xff0c;cuDNN等的安装&#xff0c;参考该…

和年薪30W的阿里测开工程师聊过后,才知道我的工作就是打杂的...

前几天和一个朋友聊面试&#xff0c;他说上个月同时拿到了腾讯和阿里的offer&#xff0c;最后选择了阿里。 阿里内部将员工一共分为了14个等级&#xff0c;P6是资深工程师&#xff0c;P7是技术专家。 其中P6和P7就是一个分水岭了&#xff0c;P6是最接近P7的不持股员工&#x…

720°VR全景家装设计,为传统行业注入新生命力

导语&#xff1a;VR全景家装是一种基于虚拟现实技术的新型家居装修方案&#xff0c;可以通过虚拟现实技术让用户更真实地体验家居装修效果&#xff0c;避免了传统装修中的繁琐流程和不可预知的风险。近几年来&#xff0c;VR全景装修盛行&#xff0c;打破传统二维空间模式&#…

【ArcGIS学习记录01】--利用CRU TS数据集绘制降雨量分布图

【ArcGIS学习记录01】–利用CRU TS数据集绘制降雨量分布图 注&#xff1a;仅作为本人的学习记录方便以后复习查阅。 一、介绍 CRU TS 是目前使用最广泛的气候数据集之一&#xff0c;由英国国家大气科学中心 (NCAS) 制作。简而言之我们能在CRU TS官网上获得几乎各个研究领域能…

[Java基础]—JDBC

前言 其实学Mybatis前就该学了&#xff0c;但是寻思目前主流框架都是用mybatis和mybatis-plus就没再去看&#xff0c;结果在代码审计中遇到了很多cms是使用jdbc的因此还是再学一下吧。 第一个JDBC程序 sql文件 INSERT INTO users(id, NAME, PASSWORD, email, birthday) VAL…