完整的Git命令参考,按功能分类,支持搜索和一键复制
git initgit clone <url>git config --global user.name "Your Name"git config --global user.email "[email protected]"git add <file>git add .git add -Agit add -pgit rm --cached <file>git commit -m "message"git commit --amendgit commit -am "message"git commit --allow-empty -m "message"git commit -S -m "message"git branchgit branch -agit checkout <branch>git checkout -b <new-branch>git switch <branch>git switch -c <new-branch>git branch -d <branch>git branch -D <branch>git merge <branch>git merge --abortgit rebase <branch>git rebase --continuegit rebase --abortgit remote -vgit push origin <branch>git push -u origin <branch>git pullgit fetchgit remote add origin <url>git restore --staged <file>git restore <file>git reset --soft HEAD~1git reset --mixed HEAD~1git reset --hard HEAD~1git revert <commit>git taggit tag <tagname>git tag -a <tagname> -m "message"git push origin <tagname>git statusgit loggit log --oneline --graphgit diffgit diff --stagedgit show <commit>git shortlog初始化仓库并提交第一次代码的完整流程
git init
git add .
git commit -m "Initial commit"
创建仓库后推送本地代码的步骤
git remote add origin <url>
git push -u origin main
基于主分支创建新功能分支
git checkout -b feature/new-feature
git push -u origin feature/new-feature
合并时遇到冲突的处理方法
git merge feature/xxx
# 编辑冲突文件
git add .
git commit -m "Resolve conflicts"
撤销最后一次提交的更改
git reset --soft HEAD~1 # 保留更改
git reset --hard HEAD~1 # 丢弃更改
从远程拉取最新代码并合并
git fetch origin
git pull origin main
Git Cheatsheet是一个在线开发工具,帮助开发者高效完成相关任务。本工具在浏览器端运行,所有处理在本地完成,数据不会上传到服务器,保障你的隐私安全。开发者日常工作中经常需要这类工具来提高效率,无论是调试代码、处理数据还是格式化输出。
本工具使用JavaScript在浏览器端运行,所有操作在本地完成,不需要服务器参与。现代浏览器的JavaScript引擎提供了强大的API支持这些功能。与需要安装软件的传统方案相比,在线工具无需配置环境,打开浏览器即可使用。
// Git Cheatsheet 使用示例
// 直接在工具界面输入数据即可使用
console.log("Tool: Git Cheatsheet");
Q:是否免费使用?
完全免费,无需注册。所有操作在浏览器端完成。
Q:数据会上传吗?
不会。所有处理在浏览器本地完成,保障隐私。