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

鹤壁网站seo城乡互动联盟网站建设

鹤壁网站seo,城乡互动联盟网站建设,网站更换网址如何查找,建设网站出什么科目目录 一、初始配置 二、添加文件 三、查看日志 四、修改文件 五、版本回退 六、撤销修改 七、删除文件 一、初始配置 Git版本控制器#xff1a;记录每次的修改以及版本迭代的一个管理系统。 # 初始化本地仓库#xff1a;git init(base) [rootlocalhost gitcode]# gi…目录 一、初始配置 二、添加文件 三、查看日志 四、修改文件 五、版本回退 六、撤销修改 七、删除文件 一、初始配置 Git版本控制器记录每次的修改以及版本迭代的一个管理系统。 # 初始化本地仓库git init(base) [rootlocalhost gitcode]# git init 重新初始化现存的 Git 版本库于 /root/gitee/gitcode/.git/ (base) [rootlocalhost gitcode]# ls -a . .. .git (base) [rootlocalhost gitcode]# 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└── tags9 directories, 13 files (base) [rootlocalhost gitcode]# # 查看本地仓库配置(base) [rootlocalhost gitcode]# git config -l push.defaultmatching core.repositoryformatversion0 core.filemodetrue core.barefalse core.logallrefupdatestrue (base) [rootlocalhost gitcode]# # 配置当前仓库(base) [rootlocalhost gitcode]# git config user.name ljc (base) [rootlocalhost gitcode]# git config user.email 1210451061qq.com (base) [rootlocalhost gitcode]# git config -l push.defaultmatching core.repositoryformatversion0 core.filemodetrue core.barefalse core.logallrefupdatestrue user.nameljc user.email1210451061qq.com (base) [rootlocalhost gitcode]# # 删除当前仓库配置(base) [rootlocalhost gitcode]# git config --unset user.name (base) [rootlocalhost gitcode]# git config --unset user.email (base) [rootlocalhost gitcode]# git config -l push.defaultmatching core.repositoryformatversion0 core.filemodetrue core.barefalse core.logallrefupdatestrue (base) [rootlocalhost gitcode]# # 配置当前机器的全部仓库(base) [rootlocalhost gitcode]# git config --global user.name ljc (base) [rootlocalhost gitcode]# git config --global user.email 1210451061qq.com (base) [rootlocalhost gitcode]# git config -l push.defaultmatching user.nameljc user.email1210451061qq.com core.repositoryformatversion0 core.filemodetrue core.barefalse core.logallrefupdatestrue# 删除当前机器的全部仓库配置(base) [rootlocalhost gitcode]# git config --global --unset user.name (base) [rootlocalhost gitcode]# git config --global --unset user.email (base) [rootlocalhost gitcode]# git config -l push.defaultmatching core.repositoryformatversion0 core.filemodetrue core.barefalse core.logallrefupdatestrue (base) [rootlocalhost gitcode]# 二、添加文件 ⼯作区是在电脑上你要写代码或⽂件的⽬录。 暂存区英⽂叫 stage 或 index 。⼀般存放在 .git ⽬录下的 index ⽂件.git/index中我们把暂存区有时也叫作索引index。 版本库⼜名仓库英⽂名 repository 。⼯作区有⼀个隐藏⽬录 .git 它不算⼯作区⽽是 Git 的版本库。这个版本库⾥⾯的所有⽂件都可以被 Git 管理起来每个⽂件的修改、删除Git 都能跟踪以便任何时刻都可以追踪历史或者在将来某个时刻可以“还原”。 创建 Git 版本库时Git会为我们⾃动创建⼀个唯⼀的 master 分⽀以及指向 master 的⼀个指针叫 HEAD。对⼯作区修改或新增的⽂件执⾏ git add 命令时暂存区⽬录树的⽂件索引会被更新。执⾏提交操作 git commit 时master 分⽀会做相应的更新可以简单理解为暂存区的⽬录树才会被真正写到版本库中。 # 添加一个文件(base) [rootlocalhost gitcode]# ls (base) [rootlocalhost gitcode]# touch file1 (base) [rootlocalhost gitcode]# vim file1 (base) [rootlocalhost gitcode]# cat file1 hello git(base) [rootlocalhost gitcode]# git add file1 (base) [rootlocalhost gitcode]# git commit -m Add first file [master根提交 fc3a350] Add first file1 file changed, 2 insertions()create mode 100644 file1 (base) [rootlocalhost gitcode]# # 添加多个文件(base) [rootlocalhost gitcode]# touch file2 file3 file4 (base) [rootlocalhost gitcode]# git add . (base) [rootlocalhost gitcode]# git commit -m Add three files [master f2e9210] Add three files3 files changed, 0 insertions(), 0 deletions(-)create mode 100644 file2create mode 100644 file3create mode 100644 file4 (base) [rootlocalhost gitcode]# git log commit f2e92108d0fe7ec01a6c49d1372e4907cac6d96b Author: ljc 1210451061qq.com Date: Wed Feb 7 05:13:08 2024 0800Add three filescommit fc3a3507b30d2f4374a71245a034e00f94ea8363 Author: ljc 1210451061qq.com Date: Wed Feb 7 05:11:56 2024 0800Add first file (base) [rootlocalhost gitcode]# 三、查看日志 # git log 命令显⽰从最近到最远的提交⽇志 # 加上 --prettyonline 参数会将日志简洁显示(base) [rootlocalhost gitcode]# git log --prettyoneline f2e92108d0fe7ec01a6c49d1372e4907cac6d96b Add three files fc3a3507b30d2f4374a71245a034e00f94ea8363 Add first file (base) [rootlocalhost gitcode]## 通过 git log 可以看到的长字符串是每次提交的commit id版本号是一个哈希值 # 查看 .git(base) [rootlocalhost gitcode]# tree .git .git ├── branches ├── COMMIT_EDITMSG ├── 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 ├── index ├── info │ └── exclude ├── logs │ ├── HEAD │ └── refs │ └── heads │ └── master ├── objects │ ├── 2c │ │ └── 0f71d14208bc896178ce4eb92870c659c04202 │ ├── 74 │ │ └── cbb01783907aa0807236331230386d5e1241cf │ ├── 7f │ │ └── 112b196b963ff72675febdbb97da5204f9497e │ ├── e6 │ │ └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391 │ ├── f2 │ │ └── e92108d0fe7ec01a6c49d1372e4907cac6d96b │ ├── fc │ │ └── 3a3507b30d2f4374a71245a034e00f94ea8363 │ ├── info │ └── pack └── refs├── heads│ └── master└── tags18 directories, 24 files (base) [rootlocalhost gitcode]# # index 是暂存区add 后的内容会添加进缓存区 # HEAD 是默认指向 master 分支的指针 # 默认的 master 保存的就是最新的 commit id(base) [rootlocalhost gitcode]# cat .git/HEAD ref: refs/heads/master (base) [rootlocalhost gitcode]# cat .git/refs/heads/master f2e92108d0fe7ec01a6c49d1372e4907cac6d96b (base) [rootlocalhost gitcode]# # objects 为Git的对象库里面包含了创建的各个版本的对象及内容。 # 当执行 git add 的时候暂存区的对象树被更新 # 同时工作区修改或新增的文件内容被写入到对象库中的一个新的对象中 # 就位于 ./git/objects 目录下(base) [rootlocalhost gitcode]# ls .git/objects/ 2c 74 7f e6 f2 fc info pack# 查找 object 要将 commit id 分为两部分前2位是目录名称后38位文件名称 # 使用 git cat-file 查看版本库对象的内容 # 类型 可以是其中之一blob、tree、commit、tag # -t 显示对象类型 # -s 显示对象大小 # -e 当没有错误时退出并返回零 # -p 美观地打印对象的内容 # --textconv 对于数据blob对象对其内容执行 textconv # --batch 显示从标准输入提供的对象的信息和内容 # --batch-check 显示从标准输入提供的对象的信息(base) [rootlocalhost gitcode]# git cat-file -p f2e92108d0fe7ec01a6c49d1372e4907cac6d96b tree 74cbb01783907aa0807236331230386d5e1241cf parent fc3a3507b30d2f4374a71245a034e00f94ea8363 author ljc 1210451061qq.com 1707253988 0800 committer ljc 1210451061qq.com 1707253988 0800Add three files (base) [rootlocalhost gitcode]# git cat-file -p 74cbb01783907aa0807236331230386d5e1241cf 100644 blob 7f112b196b963ff72675febdbb97da5204f9497e file1 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 file2 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 file3 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 file4 (base) [rootlocalhost gitcode]# # 查看 file1 对应的 commit id[rootlocalhost gitcode]# git cat-file -p 7f112b196b963ff72675febdbb97da5204f9497e hello git(base) [rootlocalhost gitcode]# 四、修改文件 Git版本控制器的本质跟踪并管理文件的修改而非文件本身。 # 对file1文件内容进行修改此时工作区和暂存区的文件版本不一致 # 用 git status 查看在你上次提交之后是否有对文件进行再次修改(base) [rootlocalhost gitcode]# vim file1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world (base) [rootlocalhost gitcode]# git status # 位于分支 master # 尚未暂存以备提交的变更 # 使用 git add file... 更新要提交的内容 # 使用 git checkout -- file... 丢弃工作区的改动 # # 修改 file1 # 修改尚未加入提交使用 git add 和/或 git commit -a (base) [rootlocalhost gitcode]# # git diff [file] 查看暂存区和工作区文件的具体差异 # git diff HEAD -- [file] 查看版本库和工作区文件的具体差异(base) [rootlocalhost gitcode]# git diff file1 diff --git a/file1 b/file1 index 7f112b1..05fe86c 100644 --- a/file1b/file1-1,2 1,2 hello git - hello world (base) [rootlocalhost gitcode]# git diff HEAD -- file1 diff --git a/file1 b/file1 index 7f112b1..05fe86c 100644 --- a/file1b/file1-1,2 1,2 hello git - hello world (base) [rootlocalhost gitcode]# (base) [rootlocalhost gitcode]# git add file1 (base) [rootlocalhost gitcode]# git status # 位于分支 master # 要提交的变更 # 使用 git reset HEAD file... 撤出暂存区 # # 修改 file1 # (base) [rootlocalhost gitcode]# git commit -m modify: file1 [master 7df1e32] modify: file11 file changed, 1 insertion(), 1 deletion(-) (base) [rootlocalhost gitcode]# git status # 位于分支 master 无文件要提交干净的工作区 (base) [rootlocalhost gitcode]# 五、版本回退 Git将所有提交过的版本串成一条时间线若只有一条时间线则这个分支就是主分支即master分支。 对于master分支每一次提交master分⽀都会向前移动⼀步这样随着你不断提交master分⽀的线也越来越⻓,⽽HEAD只要⼀直指向master分⽀即可指向当前分⽀。 当进行版本回退的时候只需要改变master指针的指向就完成了版本回退非常高效。 # 给 file1 新增 vertion1 和 vertion2 两个版本并分别提交(base) [rootlocalhost gitcode]# vim file1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 (base) [rootlocalhost gitcode]# git add file1 (base) [rootlocalhost gitcode]# git commit -m modify: add vertion1 [master 167def0] modify: add vertion11 file changed, 1 insertion() (base) [rootlocalhost gitcode]# vim file1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 add vertion2 (base) [rootlocalhost gitcode]# git add file1 (base) [rootlocalhost gitcode]# git commit -m modigy: add vertion2 [master c31b56a] modigy: add vertion21 file changed, 1 insertion() (base) [rootlocalhost gitcode]# # 通过 git reset 回退版本 # 在进行版本回退之前通常先用 git log 查看历史版本(base) [rootlocalhost gitcode]# git log --prettyoneline c31b56a87a6387873d7db9a16f7d1c81b4b2339e modigy: add vertion2 167def04692b8f6fa68cc835f41a81584ca31b7e modify: add vertion1 7df1e322e9d267964f51e91dac900bb1a77f171d modify: file1 f2e92108d0fe7ec01a6c49d1372e4907cac6d96b Add three files fc3a3507b30d2f4374a71245a034e00f94ea8363 Add first file (base) [rootlocalhost gitcode]# git reset 167def04692b8f6fa68cc835f41a81584ca31b7e 重置后撤出暂存区的变更 M file1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 add vertion2 (base) [rootlocalhost gitcode]# git reset --hard 167def04692b8f6fa68cc835f41a81584ca31b7e HEAD 现在位于 167def0 modify: add vertion1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 (base) [rootlocalhost gitcode]# # 由上可见直接使用 git reset 回退版本工作区的文件内容并未修改 # 因为回退版本的完整命令格式为git reset [--soft | --mixed | --hard] [HEAD]# 不同的参数代表不同的回退方式 # --soft 对于工作区和暂存区的内容都不变只将版本库回退到指定版本 # --mixed 对于工作区的内容不变暂存区和版本库回退到指定版本默认参数 # --hard 对于工作区、暂存区和版本库都回退到指定版本# [HEAD] 说明 # 1. 可直接写成 commid id表示特定的版本 # 2. HEAD 表示当前版本 # 3. HEAD^ 表示上一个版本 # 4. HEAD^^ 表示上上个版本 # 5. ... 依此类推 # 当我回退到 vertion1 之后后悔我想再回到 vertion2 怎么办? # 1. 直接用 vertion2 的 commit id 进行回退 # 2. 如果找不到 vertion2 的 commit id 了通过 git reflog 查看本地的历史命令 # 可以得到 vertion2 的部分 commit id也可直接回退(base) [rootlocalhost gitcode]# git reflog 167def0 HEAD{0}: reset: moving to 167def04692b8f6fa68cc835f41a81584ca31b7e c31b56a HEAD{1}: commit: modigy: add vertion2 167def0 HEAD{2}: commit: modify: add vertion1 7df1e32 HEAD{3}: reset: moving to 7df1e322e9d267964f51e91dac900bb1a77f171d 3d8c2fe HEAD{4}: commit: modify: add vertion1 7df1e32 HEAD{5}: commit: modify: file1 f2e9210 HEAD{6}: commit: Add three files fc3a350 HEAD{7}: commit (initial): Add first file (base) [rootlocalhost gitcode]# git reset --hard c31b56a HEAD 现在位于 c31b56a modigy: add vertion2 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 add vertion2 (base) [rootlocalhost gitcode]# 六、撤销修改 版本回退是我们已经提交了版本更新了版本库之后再进行回退操作但是如果我们在开发过程中新写了很多代码但是没有 add 这时候忽然发现自己写的代码全是屎山代码想要回到新增代码前的版本该怎么做呢是先提交更新版本再版本回退吗 上述方式虽然也行但是太麻烦了可以直接用 git checkout -- [file] 命令让工作区的文件回到最近一次 add 和 commit 时的状态。 (base) [rootlocalhost gitcode]# vim file1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 add vertion2 too much shit code!!! (base) [rootlocalhost gitcode]# git status # 位于分支 master # 尚未暂存以备提交的变更 # 使用 git add file... 更新要提交的内容 # 使用 git checkout -- file... 丢弃工作区的改动 # # 修改 file1 # 修改尚未加入提交使用 git add 和/或 git commit -a (base) [rootlocalhost gitcode]# git checkout -- file1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 add vertion2 (base) [rootlocalhost gitcode]## 如果代码已经 add 但还没 commit 呢怎么处理 # 方法1先 git reset [file] 再 git checkout --[file] # 方法2直接 git reset --hard [file](base) [rootlocalhost gitcode]# vim file1 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 add vertion2 too much shit code (base) [rootlocalhost gitcode]# git add file1 (base) [rootlocalhost gitcode]# git status # 位于分支 master # 要提交的变更 # 使用 git reset HEAD file... 撤出暂存区 # # 修改 file1 # (base) [rootlocalhost gitcode]# git log --prettyoneline c31b56a87a6387873d7db9a16f7d1c81b4b2339e modigy: add vertion2 167def04692b8f6fa68cc835f41a81584ca31b7e modify: add vertion1 7df1e322e9d267964f51e91dac900bb1a77f171d modify: file1 f2e92108d0fe7ec01a6c49d1372e4907cac6d96b Add three files fc3a3507b30d2f4374a71245a034e00f94ea8363 Add first file (base) [rootlocalhost gitcode]# git reset --hard c31b56a87a6387873d7db9a16f7d1c81b4b2339e HEAD 现在位于 c31b56a modigy: add vertion2 (base) [rootlocalhost gitcode]# cat file1 hello git hello world add vertion1 add vertion2 (base) [rootlocalhost gitcode]# 七、删除文件 删除的本质也是修改如果我们在工作区用 rm 命令删除了一个文件那么可能是两种原因 误删确定要删除该文件 # 如果是误删那么我们需要取消删除操作也就是撤销修改操作。 # 如果是确认要删除该文件那么通过 rm 删除之后工作区和暂存区、版本库就不一致了。 # 我们该如何处理呢 # 我们需要先将删除后的工作区更新到暂存区再将暂存区提交到版本库。(base) [rootlocalhost gitcode]# ls file1 file2 file3 file4 (base) [rootlocalhost gitcode]# rm -rf file4 (base) [rootlocalhost gitcode]# ls file1 file2 file3 (base) [rootlocalhost gitcode]# git status # 位于分支 master # 尚未暂存以备提交的变更 # 使用 git add/rm file... 更新要提交的内容 # 使用 git checkout -- file... 丢弃工作区的改动 # # 删除 file4 # 修改尚未加入提交使用 git add 和/或 git commit -a (base) [rootlocalhost gitcode]# git add . warning: 您在运行 git add 时没有指定 -A (--all) 或 --ignore-removal 针对其中本地移除路径的行为将在 Git 2.0 版本库发生变化。 像本地工作区移除的路径 file4 在此版本的 Git 中被忽略。* git add --ignore-removal pathspec是当前版本的默认操作忽略您本地工作区中移除的文件。* git add --all pathspec 将让您同时对删除操作进行记录。运行 git status 来检查您本地工作区中移除的路径。(base) [rootlocalhost gitcode]# git add --all file4 (base) [rootlocalhost gitcode]# git commit -m delete file4 [master 0f28717] delete file41 file changed, 0 insertions(), 0 deletions(-)delete mode 100644 file4 (base) [rootlocalhost gitcode]# git status # 位于分支 master 无文件要提交干净的工作区 (base) [rootlocalhost gitcode]# ls file1 file2 file3 (base) [rootlocalhost gitcode]# # 由上可得我们需要处理不一致问题也就是将删除后的新版本再次提交到版本库 # 我们可以也通过 git rm 进行文件删除这样直接就删除了工作区和暂存区的文件 # 我们只需要接着 git commit -m 更新删除后的版本就行了(base) [rootlocalhost gitcode]# ls file1 file2 file3 (base) [rootlocalhost gitcode]# git rm file3 rm file3 (base) [rootlocalhost gitcode]# ls file1 file2 (base) [rootlocalhost gitcode]# git status # 位于分支 master # 要提交的变更 # 使用 git reset HEAD file... 撤出暂存区 # # 删除 file3 # (base) [rootlocalhost gitcode]# git commit -m delete file3 [master 84b615b] delete file31 file changed, 0 insertions(), 0 deletions(-)delete mode 100644 file3 (base) [rootlocalhost gitcode]#
http://www.dnsts.com.cn/news/199110.html

相关文章:

  • 怎么做网站访问量5173游戏交易网站源码
  • 做网站有什么好处静态网页制作成品
  • 东营定制网站建设服务做网站设计好的公司
  • 怀化网站建设联系方式发布建设网站
  • 用r做简易的网站免认证域名
  • asp网站建设与设计wordpress要不要放网站地图
  • 电脑咋建网站云南省网站开发
  • 江西省大余县建设局网站建设部网站职业资格证查询
  • 网站根域名是什么免费网站建设多少钱
  • 一个网站怎么做软件企业网站建设指标
  • 大通证券手机版下载官方网站下载wordpress主页教程
  • 网站建设与维护的内容网站内容管理软件
  • 中山免费建站wordpress模板在哪购买
  • wordpress全站模板wordpress答题插件
  • 怎么建立自己网站视频域名服务器ip地址
  • 金华在线制作网站暂时关闭wordpress插件
  • 用ps做网站还是wd四川二级站seo整站优化排名
  • 网站建设部署与发布答案深圳上市公司排名
  • 知识付费网站开发网站做专题主题该怎么选
  • 商标查询网站建设wordpress广告赚钱
  • 学校建设网站的意义网站建设技术代码
  • 网站建设与维护简称seo优化工具的种类
  • 建设外国商城网站亚马逊欧洲站入口网址
  • 做电影网站 资源怎么存放卡片式主题wordpress
  • seo整站优化更能准确获得客户网站首页设计收费
  • 建设银行网站怎么登陆密码忘了怎么办在centos下安装wordpress
  • discuz图片网站模板下载手机最新版app
  • 网站推广策略包括哪些内容哪家开发app好
  • 辽宁做网站和优化哪家好中关村网站建设
  • 做照片的网站西安高端网站制作公司