美文网首页
git常用命令

git常用命令

作者: 我没叫阿 | 来源:发表于2020-09-11 16:36 被阅读0次
  • 查看本地分支
    git branch

  • 提交所有更改
    git add .

  • 将本地暂存的修改提交到版本库
    git commit -m "更新了啥啥啥东西"

  • 提交
    git push

  • 拉取
    git pull

  • 只想拉取服务器代码,不想提交本地代码

  1. git stash 将修改的代码放到暂存区
  2. git pull 拉取代码
  3. git stash pop 把暂存区的代码取出
  • 克隆指定分支
    git clone -b wlf https://gitee.com/cmmc2019_1/CMMC-camp-mobile.git

  • 删除本地分支
    git branch -d wlf

  • 查看本地和远程分支的跟踪关系
    git branch -vv

  • 在当前分支下(一般是master分支),创建muscleape的本地分支分
    git checkout -b wlf

  • 将wlf分支推送到远程
    git push origin wlf

  • git commit的时候出现 pre-commit hook failed (add --no-verify to bypass)

我的解决方法
1.进入该项目的.git => hooks文件
2.删除pre-commit文件
3.然后重新commit 、push就好了

  • 本地分支切换至master时 , fatal: reference is not a tree: master

1.git pull 更新主分支至最新版本
2.git checkout master

  • 提交本地代码时,提示"tslint --fix" found some errors. Please fix them and try committing again.

git commit 后面加上 --no-verify ,如下:
git commit --no-verify -m "提交时的注释"

相关文章

网友评论

      本文标题:git常用命令

      本文链接:https://www.haomeiwen.com/subject/qrrbektx.html