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

相关推荐
夜月yeyue1 小时前
嵌入式开发中的 Git CI/CD
c++·git·单片机·嵌入式硬件·ci/cd·硬件架构
真人不梦2 小时前
Lazygit: 从0到熟练使用,你需要的都在这里
git·github
denggun123456 小时前
图片上传git时压缩
git·ios·objective-c·iphone·xcode
行走的陀螺仪8 小时前
git-旧项目继续开发新功能,同时还要维护线上版本
git·git push·git commit·git 协同开发
fendouweiqian12 小时前
git提交与commitlint规则
git
C.咖.20 小时前
Linux环境下——Git 与 GitHub
linux·git·github·远程仓库
杂鱼豆腐人1 天前
pnpm环境下防止误使用npm的方法
前端·git·npm·node.js·git bash
摇滚侠1 天前
GIT版本管理工具轻松入门 | TortoiseGit,Git 介绍软件安装配置,笔记01
笔记·git
山有木兮木有枝_1 天前
“误操作导致 feat 功能未生效,尽管 merge 已完成”
git
百锦再1 天前
第14章 智能指针
android·java·开发语言·git·rust·go·错误