Git常用命令

        
          

git status 查看当前空间状态,是否有待提交文件等等
git branch 查看本地分支状态
git branch -a 查看远程分支状态
git branch -r 查看远程分支状态
git branch -d branchName 删除分支
git push [remoteName] -d [branchName] 删除远程分支
git add fileName1, fileName2 ...
git add . 添加所有文件到staging区
git rm fileName
从staging区移除文件,同时也移除出工作目录

git rm -r --cached fileName
从staging区移除文件,但留在工作目录中

git pull [remoteName] [localBranchName] 抓取更新

git commit -m 'note' 提交
git push [remoteName] [localBranchName] 将提交推送到远程分支


    git push [remoteName] --delete [branchName1 branchName2 ...] 删除远程分支

    git checkout [localBranchName] [remoteName]/[branchName] 将远程分支检出为本地分支

    

    git reset –hard:彻底回退到某个版本,本地的源码也会变为上一个版本的内容.

            git reset --hard cdb528584a7617fc60eb20bbc649058c8185f382

    git reset –mixed:此为默认方式,不带任何参数的git reset,即时这种方式,它回退到某个版本,只保留源码,回退commit和index信息 

    git reset –soft:回退到某个版本,只回退了commit的信息,不会恢复到index file一级。如果还要提交,直接commit即可  

    

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cpongo11

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值