Git常用命令

#查看项目的分支们(包括本地和远程)

命令行 : git branch -a

#删除本地分支

命令行 : git branch -d <BranchName>

#删除远程分支

命令行 : git push origin --delete <BranchName>

强制更新远程分支

git push -f -u origin xjzhang

#修改commit

git commit --amend

#修改已经提交的过的 commit

git commit --amend

// ... edit you message

git push --force example-branch

#合并 commit

git reset --soft "HEAD~n"

(~n means ~1, ~2,...)

git commit --amend

git 删除远端分支 报错remote refs do not exist的解决方法

git fetch -p origin

git pull 报 unable to update local ref 错误

git gc --prune=now

git remote prune origin

相关推荐
__雨夜星辰__1 小时前
什么是 Git 与 Git※hub(※Git※hub加※速访※问教程)
git·github
家里有只小肥猫4 小时前
新项目git推送 删除
git
小码狐5 小时前
GIT相关
git·idea·基础
csdn_aspnet6 小时前
Git贡献全流程拆解:从Fork到PR的完整指南
git·fork·pr
XuDream7 小时前
idea中忽略idea文件不提交git和取消被 Git 追踪
java·git·intellij-idea
0xCode 小新8 小时前
Git常用操作
git·gitee·github
0vvv08 小时前
bugku-web-source(git泄露
git·ctf
Joy T8 小时前
【Web3】告别Remix:基于Hardhat的智能合约工程化构建与实战
git·web3·node·智能合约·hardhat
晨曦蜗牛8 小时前
Windows 上 Claude Code 报错 “requires git-bash“ 的完整解决方案
windows·git·bash
不想看见4049 小时前
Qt-Creator如何使用Git【步骤】
git