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

Git 常见操作

目录

1.git stash

2.合并多个commit

3. git commit -amend (后悔药)

4.版本回退

5.merge和rebase

6.cherry pick

7.分支

8.alias


1.git stash

git-stash操作_git stash 怎么增加更改内容-CSDN博客

2.合并多个commit

通过git bash工具交互式操作。

1.查询commit的commitID

git log --oneline

--oneline参数,代表将每个commit压缩成一行,只显示commitID和commit message的第一行。

d5ace53 第5次commit
25d5ae5 第4次commit
73c98f9 第3次commit
a50f132 第2次commit
d5d1335 第1次commit

2.变基到第一次commit,开启交互式操作。

git rebase -i d5d1335

 -i 参数,代表展开交互界面

pick a50f132 第2次commit
pick 73c98f9 第3次commit
pick 25d5ae5 第4次commit
pick d5ace53 第5次commit# Rebase d5d1335..d5ace53 onto d5d1335 (4 command)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
#                    commit's log message, unless -C is used, in which case
#                    keep only this commit's message; -c is same as -C but
#                    opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later wit

相关文章:

  • 【Redis技术进阶之路】「原理分析系列开篇」分析客户端和服务端网络诵信交互实现(服务端执行命令请求的过程 - 初始化服务器)
  • DiMTAIC 2024 数字医学技术及应用创新大赛-甲状腺B超静态及动态影像算法赛-参赛项目
  • GitOps 核心思想 - 当 Git 成为唯一信源
  • 【PhysUnits】17.2 配套变量结构体 Var(variable.rs)
  • 第二十九章 数组
  • [嵌入式AI从0开始到入土]18_Ascend C算子开发环境(S5赛季)
  • 【redis】线程IO模型
  • 探索数学的迷人谜题:考兰兹猜想与MATLAB演示
  • MyBatis中foreach集合用法详解
  • STM32H562----------串口通信(UART)
  • 大模型如何选型?嵌入模型如何选型?
  • (LeetCode 每日一题)386. 字典序排数(递归、深度优先搜索dfs || 递推)
  • 2.2.1 ASPICE的需求收集
  • k8s4部署
  • ESP12E/F 参数对比
  • (LeetCode 动态规划(基础版))96. 不同的二叉搜索树 (递推 || 递归)
  • 设备驱动与文件系统:04 从生磁盘到文件
  • 软件测试—学习Day11
  • 经典算法:排序链表
  • 【第九篇】 SpringBoot测试补充篇
  • 做网站公司长沙/上海百度seo
  • 网站title标签内容怎么设置/厦门关键词优化报价
  • 微信公众平台怎么做微网站吗/太原seo关键词排名
  • 基于vue.js旅游网站开发/廊坊百度关键词优化怎么做
  • 岳阳做网站推荐/营销策划公司 品牌策划公司
  • 深圳做网站哪个好/信阳网站推广公司