git常规操作

git clone git@… //初始化数据到本地
git status //检测本地修改过的文件
git branch -a //查看branch分支
git branch Jeremy //创建一个叫Jeremy的分支 (git branch -d dev 删除误建的dev分支)
git checkout Jeremy //从master切换到Jeremy这个分支上
git add * //添加修改过的文件
git commit -m “comment” //把文件修改提交到local的repository上
git push origin Jeremy //把local repository的修改同步到远程的repository

git status //查看是否还有未提交
git log //查看最近日志
git restore 文件名可以把已经修改但是没有commit的文件revert回来

理解working folder\local repository\remote repository三者之间的区别:
git add 和git rm只是发生在working folder阶段没有commit的情况下是不会影响local repository中的内容。
git commit之后才会影响local repository。
git push才会把local repository的变动同步到远程remote repository(远程网页可见)
git pull是把数据从remote repository同步到 local repository。
git checkout是把数据从local repository 同步至本地文件夹(woking folder)

命令 $ git diff 查看对比两次文件内容具体修改了什么。
命令 $ git diff HEAD – (“–”前后有空格),可以查看工作区和版本库

  • 16
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值