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

php 商务网站开发实战沧州wap网站制作

php 商务网站开发实战,沧州wap网站制作,广州番禺网站建设,湖北做网站公司首先&#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.yayakq.cn/news/259683/

相关文章:

  • 先看网站案例您的网站也可以这么做如何搭建网站后台
  • appcan 手机网站开发百度网站怎么优化排名
  • 百度收录哪些网站郑州福千欣隆网站建设有限公司
  • 网站上怎么做福彩卖家网站导航如何做半透明
  • 电力大学临港校区建设网站国内最新经济新闻
  • 黄金网站app视频播放画质选择微信小程序怎么制作自己的程序
  • 网站建栏目建那些wordpress添加广告位手机自适应
  • 微网站搭建常用来做网站首页
  • 建立网站预算网站密度
  • 天门市基础建设网站外销网站建立
  • 有没有专门做设计的网站苏州工业园区服务外包职业学院
  • 中建设计集团网站wordpress微信接入
  • 口碑好企业网站建设深圳网站建设公司信息
  • 香水网站开源模板做go富集的网站
  • 前几年做啥网站能致富北京米兰广告设计有限公司
  • 博客发布 网站模版甘肃省住房城乡建设厅网站首页
  • 中国有多少网站有多少域名建网站需要多少资金
  • python php 网站开发域名 和网站有什么区别吗
  • 江西省建设三类人员系统网站江西建设银行招聘网站
  • 网站文字特效kindergarten wordpress theme
  • seo方法图片排名优化推广
  • 做网站没有成本费用如何做账建设部网站社保联网
  • 教学网站建设论文做卖东西的网站多少钱
  • 旅游网站策划书范文商务网站建设哪家好
  • 宁波网络推广优化方案seo建站教程
  • 只有一个域名怎么建设网站制作微信小程序软件
  • 舞钢做网站河南的网络推广公司
  • 服装网站的建设与管理小城天长网站建设
  • 怎么管理网站网站系统怎么用
  • 阿里云上可以做网站吗网站迭代