zoukankan      html  css  js  c++  java
  • git操作说明

    1.提交代码到远程分支

    git branch -a   查看所有分支

    git checkout -b xxx  切换到自己的本地分支

    git checkout -b xxx origin/QA 创建并切换到QA分支

    git add test.cpp   将test.cpp加入到缓存。

    git reset HEAD test.cpp   用于取消已缓存的test.cpp内容

    git commit -m "update"   将缓存内容加入到仓库。

    git status   查看本地仓库有哪些改动。

    git push origin mcy:QA    将本地mcy分支推送到远程QA分支。

    git push origin head:QA      如果忘记切换到本地分支,可通过此条命令强制提交。

    2.删除代码到远程分支

    git rm test.cpp

    git commit -m "rm test.cpp"

    3.根据commit id回退代码

    git reset --hard 892803238432784727

    git show 892803238432784727 查看某次提交内容

    4.更新代码

    git pull origin QA   更新远程分支代码到本地

    git pull   默认拉取master代码

    git merge origin/master 远程master代码合并到本地 会merge 更安全。

    5.强制覆盖代码,放弃本地改动

    git fetch --all

    git reset --hard origin/拉取的分支

    git pull //就完成了

    放弃本地改动

    git checkout .

    6.查看分支提交的tag和Log情况

    git log --oneline --decorate

    7.分支代码补 tag

    git checkout 8888883232

    git tag test

    git push tags

    8.查看摸个文件历史记录中都做了哪些修改

    git blame 文件

    解决冲突的方法:下面这个命令会更新远端的文件 ,不会覆盖本地的文件。

     git pull --rebase origin master

  • 相关阅读:
    Ecshop去掉模版中随机出现Ecshop版权的方法
    ecshop邮件订阅按“订阅”没反应
    ecshop开发帮助
    ecshop循环计数
    ECSHOP购物车页面显示商品简单描述
    ecshop 函数列表大全
    ecshop 商品分类页 取得当前分类下的子分类方法
    ecshop调用指定分类和个数的文章列表
    thymeleaf中的th:assert用法
    thymeleaf中的模板布局
  • 原文地址:https://www.cnblogs.com/mcy0808/p/10955038.html
Copyright © 2011-2022 走看看