Git 基础命令

查看本地历史

使用 git reflog 查看本地操作历史,找到要回退的commit-id

bash 复制代码
git reflog

查看相对时间日志

bash 复制代码
git reflog --date=relative

优点‌:直观显示时间差(如"2小时前"),便于快速定位操作时间。

查看绝对时间日志

bash 复制代码
git reflog --date=iso

优点‌:精确到秒级时间戳,适用于需要精确时间的场景。

查看本地时间日志

bash 复制代码
git reflog --date=iso-local

说明‌:自动转换为本地时区时间。

回退到指定版本

使用 git reset --hard commit-id 回退到指定版本

bash 复制代码
git reset --hard commit-id
相关推荐
Howie Zphile1 天前
Git 拉 NocoBase 2.0 beta(next 分支),并“每天自动更新 + 自动编译 + 自动重启”
大数据·git·elasticsearch
吕司1 天前
Git分支管理
git
黑屋里的马1 天前
GitExtension下载、安装
git·gitextension
Geoking.1 天前
Git 中的 Rebase 与 Merge:原理、区别与最佳实践
git
invicinble1 天前
一文了解git
大数据·git·elasticsearch
我命由我123451 天前
Git 初始化本地仓库并推送到远程仓库解读
运维·服务器·经验分享·笔记·git·学习·学习方法
爱码小白1 天前
Git学习笔记
笔记·git·学习
skywalk81631 天前
sudo apt upgrade git 报错
git
_运维那些事儿1 天前
GitLabCI/CD语法
linux·服务器·git·ci/cd·gitlab·运维开发·devops
huohuopro1 天前
git基本使用
大数据·git·elasticsearch