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
相关推荐
M malloc10 小时前
当你有两个git账号时,此时你gitpush冲突后如何解决push问题
git
cuijiecheng201811 小时前
Linux控制台下git使用图形化界面进行文件对比
linux·运维·git
南_山无梅落13 小时前
Git 结合 Gitee 使用教程:从入门到实战
git·gitee
这就是佬们吗13 小时前
Windows 的 CMD 网络环境:解决终端无法联网与更新的终极指南
java·windows·git·python·spring·maven
醇氧1 天前
【git】WARNING: connection is not using a post-quantum key exchange algorithm.
git
一只程序熊1 天前
Git不常用操作记录
git
小龙1 天前
【Git 报错解决】 远程仓库 origin 已存在(`remote origin already exists`)
git·报错
BORN(^-^)1 天前
Git 操作概要
git
bigHead-1 天前
Git合并操作详解:安全高效地合并远程分支
git·安全·elasticsearch