git 常用命令

git如何查找commit内容?

1、查找commit的comment内容,使用grep参数:

git log --grep=comment注释的关键词
2、查找用户,使用author参数

git log --author=用户名关键字

git commit -s -m "descriptions about the code"

只要加入-s参数即可自动加上Signed-off-by信息

git 查看某次commit的修改内容

具体步骤:

1、首先,需要通过git log打印所有commit记录

2、找到你想查看的那次commit的commitid。

3、查看修改。

git show commitId

4、查看某次commit中具体某个文件的修改:

git show commitId fileName

git 查看某次commit涉及到哪些分支修改----

https://blog.csdn.net/yang1349day/article/details/112171438

git branch contains commitID --all
git 查看某个修改 涉及哪些tag,可以得到最低和最高版本的支持

git tag --contains commitID

git tag --contains fef9df8b594531a4257b6a3bf7e190570c17be29 |sort -V | head -n 10

git仓库迁移后,更新本地代码关联的git地址

// 查看本地代码关联的git仓库地址

git remote -v
// 删除本地关联的git仓库地址

git remote rm origin
// 本地代码关联新的仓库地址

git remote add origin 新地址

// 再次查看本地代码关联的git仓库地址

git remote -v

相关推荐
Irene19919 小时前
查看是否已安装 Git 的方法
git
my_power5209 小时前
检出git项目到android studio该如何配置
android·git·android studio
安果移不动9 小时前
Git 实战:如何优雅地撤销历史中的某一个 Commit?
git
啥都不懂的小小白13 小时前
Git 入门指南:从零开始掌握版本控制
git
AI逐月13 小时前
Git 彻底清除历史记录
大数据·git·elasticsearch
有什么东东14 小时前
Windows安装git教程以及初步使用
git
不爱吃米饭_14 小时前
Gitea 轻量级的Git方案 - Gitlab的替代品
git·gitlab·gitea
CoderJia程序员甲17 小时前
GitHub 热榜项目 - 日榜(2025-12-15)
git·ai·开源·llm·github
大柏怎么被偷了17 小时前
【Git】远程操作
git
studytosky18 小时前
Linux 基础开发工具(3):Git 控制与 GDB 调试实用指南
linux·运维·服务器·网络·数据库·git