r4a1df26 add a refering projects pick 204a801 Move filename readme to readme.md
# Rebase 6509a1f..204a801 onto 6509a1f (2 commands) # # Commands: # p, pick <commit> = use commit # r, reword <commit> = use commit, but edit the commit message # e, edit <commit> = use commit, but stop for amending # s, squash <commit> = use commit, but meld into previous commit # f, fixup <commit> = like "squash", but discard this commit's log message # x, exec <command> = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase --continue') # d, drop <commit> = remove commit # l, label <label> = label current HEAD with a name # t, reset <label> = reset HEAD to a label # m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] # . create a merge commit using the original merge commit's # . message (or the oneline, if no original merge commit was # . specified). Use -c <commit> to reword the commit message. # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST.
# 修改message信息 add a refering projects
# Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Sat Sep 26 16:57:29 2020 +0800 # # interactive rebase in progress; onto 6509a1f # Last command done (1 command done): # reword 4a1df26 add a refering projects # Next command to do (1 remaining command): # pick 204a801 Move filename readme to readme.md # You are currently editing a commit while rebasing branch 'master' on '6509a1f'. # # Changes to be committed: # modified: index.html # modified: styles/style.css # # 保存之后提示修改成功 ** 此处用到了分离头指针 detached HEAD ** $ git rebase -i6509a1f31f47 [detachedHEAD66a0265] add a refering projects Date: Sat Sep 2616:57:292020 +0800 2 files changed, 20 insertions(+), 1 deletion(-) Successfully rebased and updated refs/heads/master.
将以下内容 pick 0db0317 add index+log pick 832bbdc add style.css pick 6509a1f add js pick 0cb0cdb add a refering project pick cb14cef Move filename readme to readme.md 修改为 pick 0db0317 add index+log s 832bbdc add style.css s 6509a1f add js s 0cb0cdb add a refering project pick cb14cef Move filename readme to readme.md
# Rebase a3a2b8a..cb14cef onto 0cb0cdb (5 commands) # # Commands: # p, pick <commit> = use commit # r, reword <commit> = use commit, but edit the commit message # e, edit <commit> = use commit, but stop for amending # s, squash <commit> = use commit, but meld into previous commit # f, fixup <commit> = like "squash", but discard this commit's log message # x, exec <command> = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase --continue') # d, drop <commit> = remove commit # l, label <label> = label current HEAD with a name # t, reset <label> = reset HEAD to a label # m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] # . create a merge commit using the original merge commit's # . message (or the oneline, if no original merge commit was # . specified). Use -c <commit> to reword the commit message. #
# 说明变更理由 # This is a combination of 4 commits. Create a complete web page # This is the 1st commit message:
add index+log
# This is the commit message #2:
add style.css
# This is the commit message #3:
add js
# This is the commit message #4:
add a refering project
$ git rebase -i a3a2b8a63b [detachedHEAD0ec7bf2] Create a complete web page Date: Sat Sep 2616:47:182020 +0800 4 files changed, 133 insertions(+) create mode 100644 images/git-logo.png create mode 100644 index.html create mode 100644 js/script.js create mode 100644 styles/style.css Successfully rebased and updated refs/heads/master.
将原内容 pick 0ec7bf2 Create a complete web page pick 94e5106 Move filename readme to readme.md
修改为 # 需要合并的内容放到一起 pick a3a2b8a s 94e5106 Move filename readme to readme.md pick 0ec7bf2 Create a complete web page
保存之后有提示报错 $ git rebase -i a3a2b8a63b interactive rebase in progress; onto a3a2b8a Last command done (1 command done): pick a3a2b8a Next commands to do (2 remaining commands): squash 94e5106 Move filename readme to readme.md pick 0ec7bf2 Create a complete web page (use "git rebase --edit-todo" to view and edit) You are currently rebasing branch 'master' on 'a3a2b8a'. (all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean 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 rebase --skip' Could not apply a3a2b8a...
# 使用git rebase --continue 继续运行 # 按照之前的输入修改说明
# 说明变更理由 # This is a combination of 4 commits. Add readme.md # This is the 1st commit message:
# 提示修改成功 $ git rebase --continue [detached HEAD b659751] Add readme.md Date: Sat Sep 26 16:42:06 2020 +0800 1 file changed, 2 insertions(+) create mode 100644 readme.md Successfully rebased and updated refs/heads/master.
* fix_readme 2c64e99 Background to green fixix_css 2c64e99 Background to green master 91b8f29 Move readme to readme.md temp 81a7b4e Add test # 删除分支 提示无法删除 $ git branch -D fix_readme error: Cannot delete branch 'fix_readme' checked out at 'F:/demo/git/git_learning'
# 切换分支到master $ git checkout master Switched to branch 'master' # 重新删除分支 可以先尝试使用-d参数,如果提示告警,在使用-D $ git branch -d fix_readme error: The branch 'fix_readme' is not fully merged. If you are sure you want to delete it, run 'git branch -D fixix_css'.