美文网首页
git的基本用法总结

git的基本用法总结

作者: biababol | 来源:发表于2018-12-02 17:54 被阅读0次

    1. 初始化仓库

    > git init
    

    2. 添加文件到仓库中,让git追踪

    > git add * 或 git add .
    

    3. 查看git仓库状态

    > git status
    

    4.提交版本

    > git commit -m '初始化提交'
    

    5. 配置用户名和邮箱

    > git config user.email "***"
    > git config user.name "***"
    

    6. 版本回退

      #查看当前提交日志
    > git log 
      #每一条提交日志都有id,通过输入id前6位字符可以进行版本回退和前进
    > git reset --hard acf001
    

    7. 版本前进

      #查看所有提交日志
    > git reflog
    > git reset --hard acf001
    

    8. 推送项目

      #设置远程仓库地址
    > git remote add origin 远程仓库地址
      #首次更新远程仓库中的内容
    > git pull origin master
    > git pull origin mater --allow-unrelated-histories
      #将本地代码提交到仓库
    > git push origin master
    
    9. 克隆项目
    > git clone 远程地址

    相关文章

      网友评论

          本文标题:git的基本用法总结

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