Git merge rebase cherry-pick 以及 游离commit 的测试
Microsoft Windows [版本 10.0.17134.345]
(c) Microsoft Corporation。保留所有权利。 C:\Users\zhangyang\Desktop\branch>git init
Initialized empty Git repository in C:/Users/zhangyang/Desktop/branch/.git/ C:\Users\zhangyang\Desktop\branch>git commit -m "Init Commit" --allow-empty
[master (root-commit) 468be32] Init Commit C:\Users\zhangyang\Desktop\branch>git commit -m "C1" --allow-empty
[master f91e414] C1 C:\Users\zhangyang\Desktop\branch>git commit -m "C2" --allow-empty
[master c738d28] C2 C:\Users\zhangyang\Desktop\branch>git commit -m "C3" --allow-empty
[master 09c5904] C3 C:\Users\zhangyang\Desktop\branch>git checkout -b branch1
Switched to a new branch 'branch1' C:\Users\zhangyang\Desktop\branch>git commit -m "C4" --allow-empty
[branch1 60f5e77] C4 C:\Users\zhangyang\Desktop\branch>git commit -m "C5" --allow-empty
[branch1 85a8fe7] C5 C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --graph --all
* 85a8fe7 (HEAD -> branch1) C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git checkout 85a9fe7
error: pathspec '85a9fe7' did not match any file(s) known to git. C:\Users\zhangyang\Desktop\branch>git checkout 85a8fe7
Note: checking out '85a8fe7'. You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 85a8fe7 C5 C:\Users\zhangyang\Desktop\branch>git commit -m "C6" --allow-empty
[detached HEAD 3f0d0e2] C6 C:\Users\zhangyang\Desktop\branch>git commit -m "C7" --allow-empty
[detached HEAD 9724be1] C7 C:\Users\zhangyang\Desktop\branch>git commit -m "C8" --allow-empty
[detached HEAD ba2e2d2] C8 C:\Users\zhangyang\Desktop\branch>git status
HEAD detached from 85a8fe7
nothing to commit, working tree clean C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --graph --all
* ba2e2d2 (HEAD) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 (branch1) C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git show 3f0d0e2
commit 3f0d0e290a94035f504cb1fb43065b09ed782172
Author: yqmcu <yqmcu@foxmail.com>
Date: Mon Feb :: + C6 C:\Users\zhangyang\Desktop\branch>git show 85a8fe7
commit 85a8fe7ad54cde82285d866536a8d7cd6d74f6cb (branch1)
Author: yqmcu <yqmcu@foxmail.com>
Date: Mon Feb :: + C5 C:\Users\zhangyang\Desktop\branch>git checkout -b HEAD
fatal: 'HEAD' is not a valid branch name. C:\Users\zhangyang\Desktop\branch>git checkout -b detached
Switched to a new branch 'detached' C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --all --graph
* ba2e2d2 (HEAD -> detached) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 (branch1) C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git checkout branch1
Switched to branch 'branch1' C:\Users\zhangyang\Desktop\branch>git cherry-pick detached
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use: git commit --allow-empty Otherwise, please use 'git reset'
On branch branch1
You are currently cherry-picking commit ba2e2d2. nothing to commit, working tree clean C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --all --graph
* ba2e2d2 (detached) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 (HEAD -> branch1) C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git commit --allow-empty
[branch1 7edcbff] C8
Date: Mon Feb :: + C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --all --graph
* 7edcbff (HEAD -> branch1) C8
| * ba2e2d2 (detached) C8
| * 9724be1 C7
| * 3f0d0e2 C6
|/
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --graph
* 7edcbff (HEAD -> branch1) C8
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git checkout master
Switched to branch 'master' C:\Users\zhangyang\Desktop\branch>git rebase merge branch1 --no-ff
fatal: Needed a single revision
invalid upstream 'merge' C:\Users\zhangyang\Desktop\branch>git merge branch1 --no-ff
Already up to date!
Merge made by the 'recursive' strategy. C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --graph
* 6e2328f (HEAD -> master) Merge branch 'branch1'
|\
| * 7edcbff (branch1) C8
| * 85a8fe7 C5
| * 60f5e77 C4
|/
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git log --oneline --decorate --graph --all
* 6e2328f (HEAD -> master) Merge branch 'branch1'
|\
| * 7edcbff (branch1) C8
| | * ba2e2d2 (detached) C8
| | * 9724be1 C7
| | * 3f0d0e2 C6
| |/
| * 85a8fe7 C5
| * 60f5e77 C4
|/
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git checkout -b --help
fatal: '--help' is not a valid branch name. C:\Users\zhangyang\Desktop\branch>git checkout --help C:\Users\zhangyang\Desktop\branch>git checkout -b old 85a8fe7
Switched to a new branch 'old' C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* 85a8fe7 (HEAD -> old) C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git cherry-pick branch1
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use: git commit --allow-empty Otherwise, please use 'git reset'
On branch old
You are currently cherry-picking commit 7edcbff. nothing to commit, working tree clean C:\Users\zhangyang\Desktop\branch>git commit --allow-empty
[old 11d5930] C8
Date: Mon Feb :: + C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* 11d5930 (HEAD -> old) C8
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git reset 85a8fe7 --hard
HEAD is now at 85a8fe7 C5 C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* 85a8fe7 (HEAD -> old) C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git rebase branch1
First, rewinding head to replay your work on top of it...
Fast-forwarded old to branch1. C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* 7edcbff (HEAD -> old, branch1) C8
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git reset 85a8fe7 --hard
HEAD is now at 85a8fe7 C5 C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* 85a8fe7 (HEAD -> old) C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git merge branch1 --no-ff
Already up to date!
Merge made by the 'recursive' strategy. C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* a6aea9e (HEAD -> old) Merge branch 'branch1' into old
|\
| * 7edcbff (branch1) C8
|/
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git reset 85a8fe7 --hard
HEAD is now at 85a8fe7 C5 C:\Users\zhangyang\Desktop\branch>git rebase detached
First, rewinding head to replay your work on top of it...
Fast-forwarded old to detached. C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* ba2e2d2 (HEAD -> old, detached) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git log --oneline --graph
* ba2e2d2 (HEAD -> old, detached) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git log --oneline --graph --all --decorate
* 6e2328f (master) Merge branch 'branch1'
|\
| * 7edcbff (branch1) C8
| | * ba2e2d2 (HEAD -> old, detached) C8
| | * 9724be1 C7
| | * 3f0d0e2 C6
| |/
| * 85a8fe7 C5
| * 60f5e77 C4
|/
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git checkout master
Switched to branch 'master' C:\Users\zhangyang\Desktop\branch>git reset 09c5904 --hard
HEAD is now at 09c5904 C3 C:\Users\zhangyang\Desktop\branch>git log --oneline --graph --all --decorate
* 7edcbff (branch1) C8
| * ba2e2d2 (old, detached) C8
| * 9724be1 C7
| * 3f0d0e2 C6
|/
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 (HEAD -> master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git checkout branch1
Switched to branch 'branch1' C:\Users\zhangyang\Desktop\branch>git reset 85a8fe7 --hard
HEAD is now at 85a8fe7 C5 C:\Users\zhangyang\Desktop\branch>git log --oneline --graph --all --decorate
* ba2e2d2 (old, detached) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 (HEAD -> branch1) C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git rebase detached
First, rewinding head to replay your work on top of it...
Fast-forwarded branch1 to detached. C:\Users\zhangyang\Desktop\branch>git log --oneline --graph --all --decorate
* ba2e2d2 (HEAD -> branch1, old, detached) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 (master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git checkout master
Switched to branch 'master' C:\Users\zhangyang\Desktop\branch>git log --oneline --graph --all --decorate
* ba2e2d2 (old, detached, branch1) C8
* 9724be1 C7
* 3f0d0e2 C6
* 85a8fe7 C5
* 60f5e77 C4
* 09c5904 (HEAD -> master) C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>git merge branch1 --no-ff
Already up to date!
Merge made by the 'recursive' strategy. C:\Users\zhangyang\Desktop\branch>git log --oneline --graph --all --decorate
* 6e056d3 (HEAD -> master) Merge branch 'branch1'
|\
| * ba2e2d2 (old, detached, branch1) C8
| * 9724be1 C7
| * 3f0d0e2 C6
| * 85a8fe7 C5
| * 60f5e77 C4
|/
* 09c5904 C3
* c738d28 C2
* f91e414 C1
* 468be32 Init Commit C:\Users\zhangyang\Desktop\branch>
Git merge rebase cherry-pick 以及 游离commit 的测试的更多相关文章
- git之rebase、merge和cherry pick的区别(面试常问)
git flow图例镇楼 merge 这个简单,初学者常用.比如主分支是Dev,最新版本是01.然后小明基于此,搞了个feature 分支A,业务:打酱油.然后在上面多次提交,完成功能迭代开发,如A1 ...
- git merge rebase的区别及应用场景
前两天和同事交流发现他在日常开发中跟上游保持同步每次都是用git pull操作,而我一直习惯git fetch然后rebase,发现这两种操作后的log是有些区别的.他每次pull操作之后都会自动生成 ...
- git merge / rebase 分支的新建与合并
merge https://git-scm.com/book/zh/v2/Git-%E5%88%86%E6%94%AF-%E5%88%86%E6%94%AF%E7%9A%84%E6%96%B0%E5% ...
- git merge 和 git rebase 小结
Git merge是用来合并两个分支的. git merge b # 将b分支合并到当前分支 同样 git rebase b,也是把 b分支合并到当前分支 ---------------------- ...
- Git merge 与 git rebase的区别
Git merge的用法: git merge Dev // Dev表示某分支,表示在当前分支合并Dev分支 git merge -m "Merge from Dev" Dev ...
- Git merge && git rebase的用法
Git merge的用法: git merge Dev // Dev表示某分支,表示在当前分支合并Dev分支 git merge -m “Merge from Dev” Dev //-m可以加上m ...
- git merge和git rebase
转载于http://blog.csdn.net/wh_19910525/article/details/7554489 git merge是用来合并两个分支的. git merge b # 将b分支合 ...
- git merge与git rebase
文章源:https://blog.csdn.net/wh_19910525/article/details/7554489 git merge是用来合并两个分支的. git merge b # 将b分 ...
- git merge 和 git rebase 小结(转)
git merge是用来合并两个分支的. git merge b # 将b分支合并到当前分支 同样 git rebase b,也是把 b分支合并到当前分支 ---------------------- ...
随机推荐
- javascrip总结12:逻辑运算符与等号运算符
1 逻辑运算符 逻辑运算的结果只有true 或者 false. 1.1 与&&: 两个表达式为true的时候,结果为true. 1.2 或|| 只要有一个表达式为true,结果为tru ...
- jQuery form 插件
http://jquery.malsup.com/form/#getting-started 举例: $(document).ready(function() { $('#ff').ajaxForm( ...
- (转)对存储过程进行加密和解密(SQL 2008/SQL 2012)
原文地址:http://www.cnblogs.com/wghao/archive/2012/12/30/2837642.html 开始: 在网络上,看到有SQL Server 2000和SQL Se ...
- 关于spring”通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明“的错误
关于spring配置的问题 近日学习spring时遇到了这个问题: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreExcept ...
- 转 Delphi中XLSReadWrite控件的使用(2)---基本应用
unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ...
- Android 自定义ViewGroup,实现侧方位滑动菜单
侧方位滑动菜单 1.现在adnroid流行的应用当中很多都是用的侧方位滑动菜单如图:
- CRC-32 校验算法
crc32的头文件 ===========================分割线=========================== //crc32.h #ifndef _CRC32_H #de ...
- [.net 多线程]ThreadPool的安全机制
ThreadPool类,有两个方法我们没有用到,UnsafeQueueUserWorkItem 和UnsafeRegisterWaitForSingleObject. 为了完全理解这些方法,首先,我们 ...
- C#构造函数用法
1.实例构造函数 2.静态构造函数 3.私有构造函数 例: 创建一个类 using System; using System.Collections.Generic; using System.Lin ...
- FTP文件上传以及获取ftp配置帮助类
帮助类: using QSProjectBase; using Reform.CommonLib; using System; using System.Collections.Generic; us ...