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

网站建设有掏钱么网络营销产品

网站建设有掏钱么,网络营销产品,wordpress 在线留言插件,郑州网站推广公司首先&#xff0c;我们得了解git reset命令的形式之一&#xff1a; git reset [<mode>] [<commit>] 此命令的作用是恢复HEAD分支到<commit>位置&#xff0c;并根据<mode>决定是否恢复index file和working tree。恢复是指将staging area和working tree…

首先,我们得了解git reset命令的形式之一:

git reset [<mode>] [<commit>]

此命令的作用是恢复HEAD分支到<commit>位置,并根据<mode>决定是否恢复index file和working tree。恢复是指将staging area和working tree的状态还原到commit的状态(如果不指定commit,则默认为last commit)。如果没有pick哪个mode,即omitted mode,则mode默认为–mixed。<commit>可以为commit的hash id或引用值。

此外,mode还有两个值:–soft和–hard。

–soft不会改动(touch) index file和working tree,但是会撤销head到commit之间的all history,这是三个模式所共有的作用。

$ git statusOn branch mainChanges not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)​    modified:  README.mdno changes added to commit (use "git add" and/or "git commit -a")$ git add README.md$ git statusOn branch mainChanges to be committed:(use "git restore --staged <file>..." to unstage)​    modified:  README.md$ git log --graph --oneline\* 0a071ac (HEAD -> main) A\* 0c888f4 Initial Commit$ git reset --soft 0c888f4$ git statusOn branch mainChanges to be committed:(use "git restore --staged <file>..." to unstage)​    modified:  README.md$ git log --graph --oneline\* 0c888f4 (HEAD -> main) Initial Commit

可以观察到commit A的committed changes都reset为staged changes to be committed。原本已经stage等待commit的changes不会被reset。HEAD指向<commit>,HEAD到<commit>的提交都会被undo。

–mixed在–soft的基础上,进一步reset,它会恢复index到<commit>时的状态。已经在index中的changes会reset回working tree,note that modify working tree≠reset working tree。

$ git reset 0c888f4Unstaged changes after reset:M    README.md

git reset会报告影响到的changes。

–hard会在–mixed的基础上恢复working tree的状态。被跟踪的changes会被丢弃。

Any untracked files or directories in the way of writing any tracked files are simply deleted.

Git文档中的这句话我不是太理解,通过询问ChatGPT,翻译为:任何阻碍跟踪文件的写入的未跟踪文件或目录将被删除。

下面是一个Stack Overflow对该疑问的解释代码例子:

There is a case in which git reset --hard has effects on untracked files.$ touch a.txt$ git add .$ git commit -m'A'$ echo hello >> a.txt$ git add .$ git commit -m'B'$ git rm a.txt$ echo world > a.txt$ git status -sThe status output isD  a.txt?? a.txtThe a.txt in the index is removed and the one in the work tree is untracked.$ cat a.txtworldReset in the mode of --hard,$ git reset --hard$ cat a.txthello$ git statusOn branch masternothing to commit, working tree clean

The untracked a.txt in the work tree is deleted. But we could also say it’s been overwritten with the tracked a.txt in HEAD.

http://www.mnyf.cn/news/36567.html

相关文章:

  • 亳州有做网站的吗深圳网络推广推荐
  • dede网站迁移东莞全网推广
  • 北海百度seo西安优化排名推广
  • 前端如何做双语网站关键词快速排名不限行业
  • 中国黄金集团建设有限公司网站国外b站不收费免费2023
  • 网站优化及推广公司小广告公司如何起步
  • dede网站模板网站维护的主要内容
  • 厦门建网站品牌烟台百度推广公司
  • 做那个网站谷歌关键词搜索
  • 网站怎么做评论免费个人推广引流平台
  • 设计一个个人网站的具体步骤黄冈seo顾问
  • 用jsp做网站步骤企业线上培训平台
  • 网站外包优化搜索网站排行
  • 微信做模板下载网站有哪些内容网站推广的基本方法有哪些
  • 黑山网站制作公司公关公司排名
  • 网站建设初期宁波网络营销有哪些
  • 男女之间做那个的网站深圳seo公司排名
  • 长宁区网站制作怎样进行seo
  • 什么网站可以做音乐伴奏百度指数查询官网入口
  • 企业建网站品牌怎么做一个网站平台
  • java做自己的网站怎么做蛋糕
  • 东营网站建设公司seo和竞价排名的区别
  • wordpress做的网站效果6阿里巴巴官网首页
  • 网站开始怎么做的视频推广渠道有哪些
  • 建设网站的用途网站seo李守洪排名大师
  • 网站推广的正确方式郑州网络营销公司排名
  • 网站设计方案案例成都网站快速优化排名
  • 自适应网站开发b站好看的纪录片免费
  • django可以做多大的网站产品推广ppt
  • 现在建设一个网站需要什么技术网站制作开发