git将远程的master分支的commit都拉取到本地

将远程的master分支的commit都拉取到本地,rebase

powershell 复制代码
# 1. 保存当前工作(如果有未提交的更改)
git stash
# 2. 获取最新 main 的 commit
# 更新本地的 main 分支
git checkout main
git pull origin main
# 3. 将你的分支变基到最新 main
# 回到你的分支并 rebase
git checkout your-branch
git rebase main
# 4. 处理可能的冲突(如果有)
# git add .
# git rebase --continue
# 5. 恢复暂存的工作
git stash pop
# 6. 推送到远程(需要强制推送,因为历史改变了)
git push origin your-branch --force-with-lease
相关推荐
赵民勇2 小时前
Git命令详解
git
不老刘20 小时前
Antigravity 的 New Worktree 模式:给 AI 代理一个安全的“平行工位”
人工智能·git·ai编程·antigravity
光谱SpectrAI21 小时前
Windows 也中招:Git Bash 和 Node 仍信任泄露的 eMudhra 证书
git
YIN_尹21 小时前
【git原理与使用】git初识与安装
大数据·git·elasticsearch
Leo_Mr1 天前
Vue3 项目配置 Git 提交规范(企业通用方案:husky + commitlint + cz-git + lint-staged)
git
jyOverQ1 天前
Git rebase 和 merge 有什么区别?什么时候该用哪个?
git
晗夜未央1 天前
跨仓库 Skill 换台电脑就失效?用 Git remote 校验项目
人工智能·git·python
Lsetea1 天前
Git访问HTTPS证书不受信任:用URL级sslCAInfo限定私有CA范围
git·https·开发工具·ssl证书·ca证书
এ慕ོ冬℘゜2 天前
Git 基础入门|和 SVN 对比 + 四大区域 + 常用命令详解
git·svn
DevLoom_2 天前
macOS 命令行 curl/git 报 SSL 证书错误?eMudhra 事件完整修复指南
git·macos·ssl