Git实操记录

这篇博客介绍了Git的基本操作,包括配置用户信息、初始化仓库、克隆与切换分支、文件管理、查看历史记录以及如何进行提交和合并。还涵盖了重构文件名、保存工作片段、重新提交和同步远程更改的命令。对于Git初学者,提供了清晰的操作指南。
摘要由CSDN通过智能技术生成

 配置

$ git config --global user.name "[name]"

$ git config --global user.email "[email address]"

$ git config --global color.ui auto

创建仓库

$ git init [project-name]

$ git clone [url]

更改

$ git status

$ git diff

$ git add [file]

$ git diff --staged

$ git reset [file]

$ git commit -m "[descriptive message]"

分支

$ git branch

$ git branch [branch-name]

$ git checkout [branch-name]

$ git merge [branch]

$ git branch -d [branch-name]

重构文件名

$ git rm [file]

$ git rm --cached [file]

$ git mv [file-original] [file-renamed]

浏览历史

$ git log

$ git log --follow [file]

$ git diff [first-branch]...[second-branch]

$ git show [commit]

抑制跟踪

*.log build/ temp-*

$ git ls-files --other --ignored --exclude-standard

保存片段

$ git stash

$ git stash pop

$ git stash list

$ git stash drop

重新提交

$ git reset [commit]

$ git reset --hard [commit]

同步更改

$ git fetch [bookmark]

$ git merge [bookmark]/[branch]

$ git push [alias] [branch]

$ git pull

 

参考文件

帮助文档

Github 简明教程

Git五分钟教程

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值