
🔥艾莉丝努力练剑:个人主页
❄专栏传送门:《C语言》、《数据结构与算法》、C/C++干货分享&学习过程记录、Linux操作系统编程详解、笔试/面试常见算法:从基础到进阶、测试开发要点全知道
⭐️为天地立心,为生民立命,为往圣继绝学,为万世开太平
🎬艾莉丝的简介:


查看安装版本:git --verion 下载:(sudo) yum install git -y 卸载:(sudo) yum remove git -y
// 查看安装版本
git --verion
// 下载
(sudo) yum install git -y
// 卸载
(sudo) yum remove git -y 这里博主因为已经安装过git了,所以就只演示一下【查看安装版本】的操作——

如果你的的平台是ubuntu,安装git相当简单,以ubuntu20.04为例——
$ git
Command 'git' not found, but can be installed with:
sudo apt install git$sudo apt-get install git -y$ git --versionmkdir gitcodegit inittree .git/运行如下——
[root@VM-4-17-centos dir]# mkdir gitcode
[root@VM-4-17-centos dir]# ls
gitcode test.c
[root@VM-4-17-centos dir]# git init
Initialized empty Git repository in /home/jqj/dir/.git/
[root@VM-4-17-centos dir]# ls
gitcode test.c
[root@VM-4-17-centos dir]# tree .git/
.git/
|-- branches
|-- config
|-- description
|-- HEAD
|-- hooks
| |-- applypatch-msg.sample
| |-- commit-msg.sample
| |-- post-update.sample
| |-- pre-applypatch.sample
| |-- pre-commit.sample
| |-- prepare-commit-msg.sample
| |-- pre-push.sample
| |-- pre-rebase.sample
| `-- update.sample
|-- info
| `-- exclude
|-- objects
| |-- info
| `-- pack
`-- refs
|-- heads
`-- tags
9 directories, 13 filesgit config user.name "[名字]"
git config --unset user.name
git config user.email "[email]"
git config --unset user.email
git config --global user.name "[名字]"
git config --global --unset user.name
git config --global user.email "[email]"
git config --global --unset user.emailgit config -l[root@VM-4-17-centos dir]# git config user.name "jqj"
[root@VM-4-17-centos dir]# git config -l
user.name=jqj
user.email=18106882575@163.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
user.name=jqj[root@VM-4-17-centos dir]# git config user.name "181xxxxxxxx@163.com"
[root@VM-4-17-centos dir]# git config -l
user.name=jqj
user.email=181xxxxxxxx@163.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
user.name=181xxxxxxxx@163.com[root@VM-4-17-centos dir]# git config --global user.name "[名字]"
[root@VM-4-17-centos dir]# git config --global user.email "[email]"
[root@VM-4-17-centos dir]# git config -l
user.name=[名字]
user.email=[email]
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
一台服务器上可以创建多个本地仓库,加了--global选项,目的是在当前机器的所有git仓库生效。




[jqj@VM-4-17-centos gitcode]$ touch file1 file2 file3
[jqj@VM-4-17-centos gitcode]$ ls
file1 file2 file3
[jqj@VM-4-17-centos gitcode]$ git add file "add 3 file"
fatal: pathspec 'file' did not match any files
[jqj@VM-4-17-centos gitcode]$ git add file1 file2 file3
[jqj@VM-4-17-centos gitcode]$ git commit -m "add 3 file"
cat .git/HFAD
ref refs/heads/master
cat .git/refs/heads/master // 对象
git cat -file -p [commit ID]查看对象内容:cat -file。



刚开始学习git的时候,进行一些操作,都要与.git目录中的结构变化对应着来看,有利于了解git目录细节流程。

















以上就是文件删除的两种流程,git rm [文件名]更快捷。










创作过程中难免有所缺漏,如果uu们发现艾莉丝的文章哪里有所疏忽,望不吝赐教!感谢支持!
往期回顾:
本文为本专栏的开篇之作,因此暂时还没有【往期回顾】环节,后期会加入的。
结语:都看到这里啦!那请大佬不要忘记给博主来个“一键四连”哦!
🗡博主在这里放了一只小狗,大家看完了摸摸小狗放松一下吧!🗡 ૮₍ ˶ ˊ ᴥ ˋ˶₎ა