git基本手册

Git and GitHub for Beginners Tutorial - YouTube

Kevin Stratvert


git config --global user.name "xxx"

git config --global user.email xxx@xx.com

设置默认分支

git config --global init.default branch main

git config -h查看帮助

详细帮助

git help config

清除

clear

进入目录

cd c:/x/

初始化存储库

git init

git status

跟踪一个文件,git才会关注其变化,未跟踪不关注

跟踪文件

git add xx.html

不想再跟踪

想要git完全忽视某些文件

.gitignore文件里写你要忽视的文件

跟踪所有文件

git add --all ; git add -A ; git add .

commit

commit就像一个快照

git commit -m "first commit - committing all file to the reposit"

查看差异

git diff

文件的三种状态,

1.working file

2.staging

3.commit

将该文件退为woking file, commit的时候将不再有它,因为它不是staging

git restore --staged index.htm

提交所有,绕过暂存 ?

git commit -a -m "updated "

如果你删除了某文件,找回

git restore "xxx.htm"

改名

git mv "x.png" "s.png"

然后提交

git commit -m "changed png name"

查看commit log

git log

git log --oneline

修改上一个commit

git commit -m "last one commit changed name png" --amend

查看commit 修改的文本

git log -p

q退出视图

git help log

回滚

git reset c193894

修改历史commit记录

git rebase -i --root

:x退出视图

branch

git branch FixTmp

查看所有分支

git branch

切换活动分支

git switch FixTmp

git commit -a -m "changed x.x"

switch branch main

合并FixTmp

git merge -m "Merge to main" FixTmp

删除分支

git branch -d FixTmp

转换并创建一个新的分支

git switch -c UpdateText

合并冲突处理

合并之后失败,再去文件里修改

连接github

新建仓库页面有提示

git remote add orgion https://github.com/k/ks.com.git

git branch -M main

上云

git push -u origin main

所有分支

git push --all

issues

39.55

远程跟踪所有分支下载

git fetch

之后合并

git merge

或者直接

git pull

相关推荐
雮尘2 小时前
让 AI Agent 高效并行开发的命令-git worktree
人工智能·git·agent
南果梨1 天前
OpenClaw 完整教程!从安装到使用(官方脚本版)
前端·git·开源
Selicens2 天前
git批量删除本地多余分支
前端·git·后端
闲云一鹤3 天前
Git LFS 扫盲教程 - 你不会还在用 Git 管理大文件吧?
前端·git·前端工程化
vibecoding日记6 天前
为什么我就想要「线性历史 + Signed Commits」,GitHub 却把我当猴耍 🤬🎙️
git·编程工具
程序员小崔日记6 天前
如何将代码轻松上传到 Gitee?Git 使用全攻略!
git·gitee·上传
Bigger7 天前
为什么你的 Git 提交需要签名?—— Git Commit Signing 完全指南
git·开源·github
DianSan_ERP8 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
红豆子不相思8 天前
Tomcat 环境搭建与集群实战
服务器·git·tomcat