zoukankan      html  css  js  c++  java
  • git命令

    git config --global user.name "tonggc1668"
    git config --global user.email "tonggc1668@163.com"
    cd D:
    mkdir git
    cd git
    pwd
    git init
    如果想要放弃当前rebase操作,用
    git rebase --abort
    如果冲突已经解决,先add冲突文件,之后
    git rebase --continue

    查看分支:git branch

    创建分支:git branch <name>

    切换分支:git checkout <name>

    创建+切换分支:git checkout -b <name>

    合并某分支到当前分支:git merge <name>

    删除分支:git branch -d <name>

    保存暂存区git stash save -u "保存内容说明"
    git stash list
    git stash pop
    git stash drop stash@{0}

    git diff master --stat
    git diff master > test.patch
    git apply test.patch  或  patch -p1 < test.patch

    1.创建补丁,比如把最新的两次提交纪录转化为补丁文件,可以用如下命令:
    git format-patch HEAD~~

    git format-patch 某个版本之后都生成(不包括此版本提交)


    1 使用git format-patch生成所需要的patch:
    当前分支所有超前master的提交:
    git format-patch -M master
    某次提交以后的所有patch:
    git format-patch 4e16 --4e16指的是commit名
    从根到指定提交的所有patch:
    git format-patch --root 4e16
    某两次提交之间的所有patch:
    git format-patch 365a..4e16 --365a和4e16分别对应两次提交的名称
    某次提交(含)之前的几次提交:
    git format-patch –n 07fe --n指patch数,07fe对应提交的名称
    故,单次提交即为:
    git format-patch -1 07fe

    2应用patch:
    先检查patch文件:git apply --stat newpatch.patch
    检查能否应用成功:git apply --check newpatch.patch

    git am之前, 你要首先
    git am --abort
    git am patch/*.patch
    git log

    打补丁:git am --signoff < newpatch.patch
    (使用-s或--signoff选项,可以commit信息中加入Signed-off-by信息)


    git config --global user.name username
    git config --global user.email username@mail.163.com
    cd C:/Users/username/git/projectname

    pwd
    git init

    git clone https://username@xxx.net/bitbucket/projectname.git -b feature/test

    git checkout feature/test

    git log

    git revert

    git stash save "messeag"
    git stash list
    git stash show stash@{id}
    git stash pop stash@{id}
    git stash drop <stash@{id}>
    git stash clear

  • 相关阅读:
    103. 二叉树的锯齿形层次遍历
    102. 二叉树的层次遍历
    94. 二叉树的中序遍历
    Redis和数据库 数据同步问题
    203. 移除链表元素
    19. 删除链表的倒数第N个节点
    237. 删除链表中的节点
    141. 环形链表
    2. 两数相加
    143. 重排链表
  • 原文地址:https://www.cnblogs.com/tonggc1668/p/8117806.html
Copyright © 2011-2022 走看看