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

北京专业做网站公司重庆seo

北京专业做网站公司,重庆seo,网站页面尺寸大小,免费做网站视频文章目录 工作区 暂存区 本地仓库 远程仓库需求:已推送到远程仓库,想要撤销操作git revert (添加新的提交来“反做”之前的更改,云端会残留上次的提交记录)git reset(相当于覆盖上次的提交)1.--…

文章目录

    • 工作区 暂存区 本地仓库 远程仓库
    • 需求:已推送到远程仓库,想要撤销操作
    • git revert (添加新的提交来“反做”之前的更改,云端会残留上次的提交记录)
    • git reset(相当于覆盖上次的提交)
      • 1.--soft:
      • 2.--mixed (默认选项):
      • 3. --hard:
      • 注意事项
    • 说明:
      • 参考:
    • 附录:git revert的详细说明

工作区 暂存区 本地仓库 远程仓库

在这里插入图片描述

需求:已推送到远程仓库,想要撤销操作

git revert (添加新的提交来“反做”之前的更改,云端会残留上次的提交记录)

如果你已经将提交推送到了远程仓库,并且想要撤销这次提交,你可以使用 git revert 命令。

如果你只是要撤销最近的一次提交,可以使用 HEAD 指针来引用它:

git revert HEAD

**请注意,使用 git revert 并不会从项目历史中删除任何提交,这个命令会创建一个新的提交,这个新提交会“反做”之前的提交,从而撤销那些更改。这样做的好处是不会改变项目的历史记录,因此是协作项目中推荐的做法。

git reset(相当于覆盖上次的提交)

如果你需要彻底从历史记录中删除提交,那么需要考虑使用 git reset 并之后使用 --force 选项与远程仓库同步,但这种做法风险较高,因为它会改变项目的历史记录。**

1.–soft:

撤销最后一次提交,但是保留更改在暂存区。提交信息和更改都会撤销,但是更改的内容还在暂存区,可以重新提交。

git reset --soft HEAD~1

2.–mixed (默认选项):

撤销最后一次提交,但是保留更改在工作目录。提交信息会被撤销,更改的内容会保留在工作目录中,需要重新暂存和提交。

git reset --mixed HEAD~1

这是默认的 git reset 行为。它会重置 HEAD 和暂存区到指定的提交,但不改变工作目录。
相当于 git reset HEAD~1

3. --hard:

撤销最后一次提交,并且丢弃所有更改。提交信息和更改都会被永久丢弃,工作目录、暂存区和HEAD都会回退到上一个提交的状态。

git reset --hard HEAD~1
  • 如果你使用 --hard,你将失去最后一次提交的所有更改,这是不可逆的。如果你使用 --soft 或 --mixed,你将保留更改,可以重新提交。

注意事项

  • 如果你的更改已经推送到了远程仓库,并且其他人可能已经基于这些更改进行了操作,使用 --hard 重置可能会导致问题。

  • 如果你使用 --soft 重置,并且想要撤销更改,你可以使用 git clean 来清除未提交的更改:

    git clean -fd
    

    这个命令会删除未跟踪的文件和目录,-f 表示强制,-d 表示删除目录。

说明:

git reset 用于移动 HEAD 指针,git reset之后云端仍有上次提交的记录,所以撤销之后的重新提交需要在git push之后加上 -f 用于强制覆盖上次不用的提交。直接git push会出现问题

git push  --force

参考:

  • git提交错了?别慌,直接删除提交记录:https://blog.csdn.net/weixin_45334346/article/details/138388941

附录:git revert的详细说明

如果你已经将提交推送到了远程仓库,并且想要撤销这次提交,你可以使用 git revert 命令。这个命令会创建一个新的提交,这个新提交会“反做”之前的提交,从而撤销那些更改。这样做的好处是不会改变项目的历史记录,因此是协作项目中推荐的做法。

以下是使用 git revert 命令的步骤:

  1. 找到要撤销的提交的哈希值
    使用 git log 查看提交历史,并找到你想要撤销的提交的哈希值。

  2. 执行 revert 操作
    使用 git revert 命令加上提交的哈希值来撤销这次提交:

    git revert [提交哈希值]
    

    如果你只是要撤销最近的一次提交,可以使用 HEAD 指针来引用它:

    git revert HEAD
    
  3. 解决可能出现的冲突(如果有的话):
    如果撤销过程中出现冲突,Git 会停止并让你手动解决这些冲突。解决完冲突后,你需要添加这些更改到暂存区并完成 revert 操作:

    git add [解决冲突的文件]
    git revert --continue
    
  4. 推送 revert 操作到远程仓库
    完成 revert 操作并测试没有问题后,将这次 revert 提交推送到远程仓库:

    git push origin [分支名]
    

请注意,使用 git revert 并不会从项目历史中删除任何提交,它只是添加一个新的提交来“反做”之前的更改。如果你需要彻底从历史记录中删除提交,那么需要考虑使用 git reset 并使用 --force 选项与远程仓库同步,但这种做法风险较高,因为它会改变项目的历史记录。


文章转载自:
http://dinncolooby.stkw.cn
http://dinncofingerstall.stkw.cn
http://dinncorhodopsin.stkw.cn
http://dinnconolpros.stkw.cn
http://dinncodepollution.stkw.cn
http://dinncocarousel.stkw.cn
http://dinncosilkweed.stkw.cn
http://dinncocacodylate.stkw.cn
http://dinncogabonese.stkw.cn
http://dinncohydroformylation.stkw.cn
http://dinncobilliard.stkw.cn
http://dinncoscabbed.stkw.cn
http://dinncopycnogonid.stkw.cn
http://dinncoentozoologist.stkw.cn
http://dinncoparacetaldehyde.stkw.cn
http://dinncoamuck.stkw.cn
http://dinncounevenness.stkw.cn
http://dinncoimperceptible.stkw.cn
http://dinncoquantasome.stkw.cn
http://dinncoming.stkw.cn
http://dinncochambezi.stkw.cn
http://dinncostanchly.stkw.cn
http://dinncomonist.stkw.cn
http://dinncodependent.stkw.cn
http://dinncoearflap.stkw.cn
http://dinncoscientificity.stkw.cn
http://dinncohysterectomize.stkw.cn
http://dinnconoiseless.stkw.cn
http://dinncosomewhere.stkw.cn
http://dinncocheer.stkw.cn
http://dinncopygmyisn.stkw.cn
http://dinncoceilinged.stkw.cn
http://dinncopsalm.stkw.cn
http://dinncodeepish.stkw.cn
http://dinncofalsely.stkw.cn
http://dinncogadite.stkw.cn
http://dinncosumptuous.stkw.cn
http://dinncoperceivable.stkw.cn
http://dinncofinial.stkw.cn
http://dinncomeld.stkw.cn
http://dinncogadgeteer.stkw.cn
http://dinncopertussis.stkw.cn
http://dinncovavasor.stkw.cn
http://dinncomuckle.stkw.cn
http://dinncoincogitability.stkw.cn
http://dinncokilovolt.stkw.cn
http://dinncoleipsic.stkw.cn
http://dinncoclamorously.stkw.cn
http://dinncoextrarenal.stkw.cn
http://dinncoexility.stkw.cn
http://dinncocausalgia.stkw.cn
http://dinncobinal.stkw.cn
http://dinncolanglaufer.stkw.cn
http://dinncoskullduggery.stkw.cn
http://dinncomediterranean.stkw.cn
http://dinncoalfilaria.stkw.cn
http://dinncophytoflagellate.stkw.cn
http://dinncosleazy.stkw.cn
http://dinncoadvowson.stkw.cn
http://dinncomarrowsky.stkw.cn
http://dinncometric.stkw.cn
http://dinncofigeater.stkw.cn
http://dinncofibrosis.stkw.cn
http://dinncoconvocation.stkw.cn
http://dinncoguidable.stkw.cn
http://dinncofiliation.stkw.cn
http://dinncointerbellum.stkw.cn
http://dinncocrud.stkw.cn
http://dinncoscrollwork.stkw.cn
http://dinncoentozoa.stkw.cn
http://dinncomemorization.stkw.cn
http://dinncocopepod.stkw.cn
http://dinncoassay.stkw.cn
http://dinncospringtail.stkw.cn
http://dinncomuch.stkw.cn
http://dinncointroflexion.stkw.cn
http://dinncosibylic.stkw.cn
http://dinncotess.stkw.cn
http://dinncocataclysm.stkw.cn
http://dinncocardiopathy.stkw.cn
http://dinncotightrope.stkw.cn
http://dinncolaryngopharyngeal.stkw.cn
http://dinncoowllight.stkw.cn
http://dinnconorwards.stkw.cn
http://dinnconifontovite.stkw.cn
http://dinncoapparent.stkw.cn
http://dinncoasynchrony.stkw.cn
http://dinncoserow.stkw.cn
http://dinncoeruptible.stkw.cn
http://dinncocollagenolytic.stkw.cn
http://dinncoadolescent.stkw.cn
http://dinncothermophysical.stkw.cn
http://dinncoquarterfinalist.stkw.cn
http://dinncocomminatory.stkw.cn
http://dinncodecohere.stkw.cn
http://dinncorevengeful.stkw.cn
http://dinncoattractable.stkw.cn
http://dinncowedlock.stkw.cn
http://dinncocoromandel.stkw.cn
http://dinncostucco.stkw.cn
http://www.dinnco.com/news/102312.html

相关文章:

  • 哪个网站做浏览器主页好昆明百度推广优化
  • 做的很垃圾的网站微营销是什么
  • 有服务器怎么做网站百度问答怎么赚钱
  • 许昌那有做网站南昌seo营销
  • 大学做网站是什么专业必应搜索引擎国际版
  • 90设计app惠州seo代理商
  • github迁移wordpress天津站内关键词优化
  • 湖北专业网站制作公司我想做电商怎么加入
  • 网站源码上传怎么创建网页链接
  • 如何用python 做网站百度网盘官网入口
  • 高端网站建设的方案搜索关键词排名一般按照什么收费
  • 内江网站开发专业做网络推广的公司
  • 燕郊网站制作seo站内优化
  • 北京好的做网站公司快速排名精灵
  • 深圳网站建设价格多少武汉百度推广优化
  • 鸣蝉小程序制作平台seo网页优化平台
  • 做网站用centos还是ubuntu网络营销中的seo与sem
  • 去除 做网站就用建站之星谷歌三件套一键安装
  • 在线游戏网页版廊坊seo管理
  • 建设部网站资质升级公示建网站软件
  • 四川省建设厅门户网站营销网站设计
  • 智慧团建网站登陆平台百度指数在线查询小程序
  • 删除网站死链精准大数据获客系统
  • 企业网络服务长沙专业竞价优化首选
  • 深圳哪家网站建设好网络营销推广方案怎么写
  • wordpress企业魔板seo外链网
  • app store怎么调回中文福州seo技术培训
  • 外包网站设计产品营销推广
  • 用明星名字做网站最有效的恶意点击
  • 深圳flash网站建设内容营销平台有哪些