zoukankan      html  css  js  c++  java
  • git 在Windows上的应用

    1. 下载Windows下的git版本,下载地址:

    https://git-scm.com/downloads

    2.  安装git,一路next

    3. 在桌面创建文件夹 git/test/

    4. 鼠标右键,Git Bash Here,可以弹出在当前目录的git命令窗口

    5. 初始化用户名,邮箱,仓库

    git config --global user.name 'name'

    git config --global user.email 'email'

    git init

    6. 将文件拷贝到刚刚新建的目录

    git status 查看改动

    7. git commit -m 'note',提交文件

    8. 修改文件

    git status 查看改动

    9. git commit -m 'note', 再次提交

    10. git log,查看改动日志

     11. 打patch,打patch可以用git format-patch命令,也可以用diff命令,diff命令不需要新建仓库就可以使用,git命令需要,但是还是推荐使用git命令

        使用方法(直接给一些examples):

        git format-patch

        $ git format-patch HEAD^                 #生成最近的1次commit的patch

        $ git format-patch HEAD^^               #生成最近的2次commit的patch

        $ git format-patch HEAD^^^               #生成最近的3次commit的patch

        $ git format-patch HEAD^^^^                #生成最近的4次commit的patch

        $ git format-patch <base r1>..<latest r2>                          #生成两个commit间的修改的patch(包含两个commit. <r1>和<r2>都是具体的commit号)
        $ git format-patch -1 <r1>                                                  #生成单个commit的patch
        $ git format-patch <r1>                                                      #生成某commit以来的修改patch(不包含该commit)
        $ git format-patch --root <r1>             #生成从根到r1提交的所有patch

     

     12. 在Terminal 或者git控制条 执行 回退到某个版本命令

    git reset --hard 139dcfaa558e3276b30b6b2e5cbbb9c00bbdca96 

    参考链接:

    https://blog.csdn.net/tobeng/article/details/80868818

    https://www.cnblogs.com/ArsenalfanInECNU/p/8931377.html

  • 相关阅读:
    PHP curl_share_init函数
    使用脚本管理mongodb服务
    多项式全家桶
    Resharper 如何把类里的类移动到其他文件
    Resharper 如何把类里的类移动到其他文件
    win10 17025 触摸bug
    win10 17025 触摸bug
    VisualStudio 自定义外部命令
    VisualStudio 自定义外部命令
    C# Find vs FirstOrDefault
  • 原文地址:https://www.cnblogs.com/hanrp/p/11471111.html
Copyright © 2011-2022 走看看