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

相关推荐
深海鱼在掘金4 天前
Git 完全指南 —— 第1章:Git 概览与版本控制演进
git
noravinsc5 天前
关于Git Flow
git
蜜獾云5 天前
在Git中配置用户名和密码
git
scx_link5 天前
通过git bash在本地创建分支,并推送到远程仓库中
开发语言·git·bash
南大白5 天前
IntelliJ IDEA 运行时的 JVM 本地内存溢出崩溃
git
码农小旋风5 天前
Claude Code 基础用法大全:对话、分析、修改、测试、Git 和工作流
人工智能·git·chatgpt·claude
南大白5 天前
Git 撤回提交完整方案
git
像风一样的男人@5 天前
python --实现代理服务器
git·ui
sbjdhjd5 天前
从零搭建企业级 CI/CD(下):Jenkins+GitLab+Harbor 全链路实战指南
git·servlet·ci/cd·云原生·云计算·gitlab·jenkins
码云数智-大飞5 天前
Go Channel 详解:并发通信的正确姿势
前端·数据库·git