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

相关推荐
1379003408 小时前
Git 设置代理
git
xiaodunmeng15 小时前
sourcetree gitee 详细使用
git
LostSpeed16 小时前
git,gitea - tool - creat Gitea Empty Rep Dir
git·gitea
前端郭德纲19 小时前
vscode默认终端怎么设置成git bash
git·vscode·bash
近听水无声4771 天前
git 学习(基于Ubuntu和gitee)
git
2401_826097622 天前
同步&异步日志系统-日志落地模块的实现
c++·git·vim
半旧夜夏2 天前
阿里云IOT消息处理
java·ide·git·物联网·spring·阿里云
我们的五年2 天前
【Git版本控制器】第三弹——版本回退,撤销修改,删除文件
大数据·linux·git
一名嵌入式糕手2 天前
Git从基础到进阶
git
不cong明的亚子2 天前
github用户名密码登陆失效了
git·github