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

相关推荐
程序猿多布20 分钟前
Fork操作笔记
git·fork
荪荪22 分钟前
在本地建立git仓库
git
OYangxf1 小时前
Git Rollback, Reset and Restore的使用
git
AIMath~2 小时前
git管理代码仓库的工具
git
techdashen6 小时前
为 Agent 重新设计的 Git:Cloudflare Artifacts 是什么,怎么工作的
git
赖在沙发上的熊7 小时前
Git多仓库协作中和并冲突问题:“不相关历史合并”+“问跟踪文件冲突”
git
风若飞8 小时前
▎ 适用于完全没有 Git 经验的新手
git
时空自由民.10 小时前
git rebase简介
git
山西瀚辰信安科技有限公司10 小时前
git下载安装及使用
git·学习
梓沂11 小时前
pycharm Git 连接 GitHub 报错全记录:从 SSL 证书到 SSH 密钥,一步步踩坑与解决
git·pycharm·github