git的使用

Gitee-Git大全

常用命令
  1. git config -l
  2. git clone [url]
  3. 添加远程库 git remote add origin git@server-name:path/repo-name.git
  4. 推送到远程库 (第一次)git push -u origin master,往后不加-u即可
  5. git reset --hard commit_id 版本回退
  6. git log 查看提交历史
  7. git log --graph 查看分支合并图
  8. git reflog 查看命令历史
  9. git checkout – file 丢弃工作区修改
  10. git reset HEAD <file> // head是个指针,指向的是当前分支
  11. git rm 删除文件
  12. git init/clone 初始化当前目录为一个Git代码库/克隆一个库
  13. git config --list 显示当前配置
  14. 设置提交代码时的用户信息
    git config [–global] user.name “[name]”
    git config [–global] user.email “[email address]”
  15. git add —— git commit —— git push
ssh公钥
  1. cd ~/.ssh
  2. ssh-keygen -t rsa
  3. 选择public公钥去复制粘贴到远程仓库
分支
  1. git checkout [branch name] 切换分支
  2. git checkout -b [branch name] 创建并切换到分支
  3. git branch 查看分支,当前分支前会有个*号
  4. git branch -d [branch name] 删除分支
  5. git merge [branch_name_01] 把01分支内容合并到当前分支
  6. git switch -c [branch name] 创建并切换到分支
  7. git switch [branch name] 切换分支
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值