git命令的使用

配置git用户名和邮箱

git config --global user.name "Your Name"

git config --global user.email you@example.com

初始化版本库

git init

添加文件到版本库(从工作区状态 到 暂存区状态)

git add -- filename

git commit -m "对于本次提交的备注"

查看仓库状态

git status

撤销对文件的改动

git checkout -- filename

撤销 暂存区 中文件变动的记录

git reset HEAD filename

查看git日志

git log

恢复到之前的某一次提交之后的状态

git reset --hard 1efd0f7233cf89a185c49939bccac3bd65d75a65     (使用git log命令可以查找到每一次操作对应的hard值)

标签管理

分支管理

创建新的分支:

查看分支:git branch

切换分支

合并分支

git工作流

把本地的git仓库添加到远程的github仓库

…or create a new repository on the command line

echo "# 555" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/mydre/555.git
git push -u origin master

…or push an existing repository from the command line

git remote add origin https://github.com/mydre/555.git
git push -u origin master
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值