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

一些常用到的git命令

git stash -a  //缓存所有文件
git checkout -b dev origin/dev //切换到dev分支上,接着跟远程的origin地址上的dev分支关联起来

//推送本地分支到远程仓库
git push origin localbranchname:remotebrancname

git revert onefile //https://www.freecodecamp.org/news/git-revert-file-reverting-a-file-to-a-previous-commit/

//Git中获取当前分支名git
git branch --show-current

//git从指定的commit创建分支
git checkout -b branchname <commit-hash>

//以下两个命令需要在git bash下执行,因为window下找不到grep\xargs命令
//This script will delete all local branches except the master branch, including the non-merged branches.
git for-each-ref --format '%(refname:short)' refs/heads | grep -v "master\|main\|develop" | xargs git branch -D

//The -d is a soft delete option and only removes the merged branches.
git for-each-ref --format '%(refname:short)' refs/heads | grep -v "master\|main\|develop" | xargs git branch -d

//合并某个提交
git cherry-pick <commit-hash>

//列出包含某个提交的所有标签
git tag --contains f3a0b78
//克隆某个Tag的代码
git clone -b v9.2.2 https://gitlab.kitware.com/vtk/vtk.git


//回滚到某个提交
git log --oneline
git reset --hard <commit-hash>
git checkout -b branchname
git push origin localbranchname:remotebranchname

http://www.lryc.cn/news/309075.html

相关文章:

  • spring boot3解决跨域的几种方式
  • 【Spring】19 @Autowired注解使用详解
  • Educational Codeforces Round 132 (Rated for Div. 2) E. XOR Tree(启发式合并+贪心)
  • JavaScript 基本数据类型的详解
  • DDR5内存相比DDR4内存的优势和区别?选择哪一个服务器内存配置能避免丢包和延迟高?
  • 篮球游戏中的挑战精神与怄气心理:扣篮被帽后的再度冲击
  • JavaScript高级程序设计
  • 初阶数据结构:栈与队列
  • Houdini学习笔记
  • 电销机器人识别客户情绪状态
  • AI推介-大语言模型LLMs论文速览(arXiv方向):2024.02.25-2024.03.01
  • Cesium插件系列——3dtiles压平
  • APS面试审核准备的常规问题
  • jvm 基础知识和jvm 调优
  • USB4之ASM2464PD与ASM2464PDX兼容与运用
  • python笔记_进制
  • 面试数据库篇(mysql)- 05什么是聚簇索引什么是非聚簇索引
  • 如何开好一家汽车美容店,汽车美容保养与装饰教学
  • Taro + node.js 注册 仿照java 中的加盐算法
  • 全量知识系统问题及SmartChat给出的答复 之9 三套工具之4语法解析器 之2
  • 简洁版用户登录系统
  • Android 监听网络状态变化
  • 【LeetCode】一周中的第几天+ 一年中的第几天
  • 深度学习 精选笔记(10)简单案例:房价预测
  • DBGridEh 的排序
  • spring-boot-starter-parent和spring-boot-dependencies介绍
  • 缓存穿透解决方案之布隆过滤器
  • pptx和ppt有什么区别?了解两者之间的微妙差异
  • LabVIEW水下温盐深数据一体化采集与分析
  • 适配器模式 详解 设计模式