日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Git Rebase vs Merge, GIt Reset vs Revert

發布時間:2024/3/7 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Git Rebase vs Merge, GIt Reset vs Revert 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Git merge vs Rebase


構造場景如下:

https://zhuanlan.zhihu.com/p/29682134?utm_source=wechat_session

Git Rest & Revert







在自己的分支上可以使用git reset, 如果是公共分支建議使用git revert,這樣可以記錄歷史。Rest是指針的移動,revert是把回退當作一次新的提交

Rebase Merge 練習
yongzhiliu@Yongzhis-MacBook-Pro ~ % cd /Users/yongzhiliu/Desktop/NHO yongzhiliu@Yongzhis-MacBook-Pro NHO % mkdir testGit yongzhiliu@Yongzhis-MacBook-Pro NHO % ls Screen Shot 2020-03-31 at 3.22.27 PM.png Screen Shot 2020-03-31 at 3.59.35 PM.png Screen Shot 2020-03-31 at 4.44.38 PM.png testGit Screen Shot 2020-03-31 at 3.39.19 PM.png Screen Shot 2020-03-31 at 4.32.48 PM.png Screen Shot 2020-03-31 at 4.54.39 PM.png yongzhiliu@Yongzhis-MacBook-Pro NHO % cd testDir cd: no such file or directory: testDir yongzhiliu@Yongzhis-MacBook-Pro NHO % cd testGit yongzhiliu@Yongzhis-MacBook-Pro testGit % ls yongzhiliu@Yongzhis-MacBook-Pro testGit % git init Initialized empty Git repository in /Users/yongzhiliu/Desktop/NHO/testGit/.git/ yongzhiliu@Yongzhis-MacBook-Pro testGit % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % ls index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % less index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git add . yongzhiliu@Yongzhis-MacBook-Pro testGit % git log fatal: your current branch 'master' does not have any commits yet yongzhiliu@Yongzhis-MacBook-Pro testGit % gs zsh: command not found: gs yongzhiliu@Yongzhis-MacBook-Pro testGit % git commit -m "master -a" [master (root-commit) 1d61d99] master -aCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+)create mode 100644 index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --oneline 1d61d99 (HEAD -> master) master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git add . yongzhiliu@Yongzhis-MacBook-Pro testGit % git commit -m "master -b" [master b81e0a5] master -bCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --oneline b81e0a5 (HEAD -> master) master -b 1d61d99 master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % git checkout -f yongzhiliu@Yongzhis-MacBook-Pro testGit % git log commit b81e0a5c466dd3a6e45308e6e509e396753e1798 (HEAD -> master) Author: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Date: Thu Apr 9 07:29:58 2020 +0800master -bcommit 1d61d993fb06569f5021bd9d1fda61de2440a94d Author: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Date: Thu Apr 9 07:28:36 2020 +0800master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % git checkout -b f Switched to a new branch 'f' yongzhiliu@Yongzhis-MacBook-Pro testGit % vi f.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % ls f.txt index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % vi f.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % vi f.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % ls f.txt index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git add . yongzhiliu@Yongzhis-MacBook-Pro testGit % git commit -m 'Branch f' [f af352fa] Branch fCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+)create mode 100644 f.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --oneline af352fa (HEAD -> f) Branch f b81e0a5 (master) master -b 1d61d99 master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % vi f.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git add . yongzhiliu@Yongzhis-MacBook-Pro testGit % git commit -m 'Branch e' [f 82809a8] Branch eCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --oneline 82809a8 (HEAD -> f) Branch e af352fa Branch f b81e0a5 (master) master -b 1d61d99 master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % git checkout master Switched to branch 'master' yongzhiliu@Yongzhis-MacBook-Pro testGit % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git add . yongzhiliu@Yongzhis-MacBook-Pro testGit % git commmit -m 'master c' git: 'commmit' is not a git command. See 'git --help'.The most similar command iscommit yongzhiliu@Yongzhis-MacBook-Pro testGit % git commit -m 'master c' [master 7920ddb] master cCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --oneline 7920ddb (HEAD -> master) master c b81e0a5 master -b 1d61d99 master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % gb zsh: command not found: gb yongzhiliu@Yongzhis-MacBook-Pro testGit % git branchf * master yongzhiliu@Yongzhis-MacBook-Pro testGit % git merge f Merge made by the 'recursive' strategy.f.txt | 2 ++1 file changed, 2 insertions(+)create mode 100644 f.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --oneline 3f8f40d (HEAD -> master) Merge branch 'f' 7920ddb master c 82809a8 (f) Branch e af352fa Branch f b81e0a5 master -b 1d61d99 master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % git view git: 'view' is not a git command. See 'git --help'. yongzhiliu@Yongzhis-MacBook-Pro testGit % git --graph unknown option: --graph usage: git [--version] [--help] [-C <path>] [-c <name>=<value>][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]<command> [<args>] yongzhiliu@Yongzhis-MacBook-Pro testGit % git -graph unknown option: -graph usage: git [--version] [--help] [-C <path>] [-c <name>=<value>][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]<command> [<args>] yongzhiliu@Yongzhis-MacBook-Pro testGit % git --help usage: git [--version] [--help] [-C <path>] [-c <name>=<value>][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]<command> [<args>]These are common Git commands used in various situations:start a working area (see also: git help tutorial)clone Clone a repository into a new directoryinit Create an empty Git repository or reinitialize an existing onework on the current change (see also: git help everyday)add Add file contents to the indexmv Move or rename a file, a directory, or a symlinkrestore Restore working tree filesrm Remove files from the working tree and from the indexexamine the history and state (see also: git help revisions)bisect Use binary search to find the commit that introduced a bugdiff Show changes between commits, commit and working tree, etcgrep Print lines matching a patternlog Show commit logsshow Show various types of objectsstatus Show the working tree statusgrow, mark and tweak your common historybranch List, create, or delete branchescommit Record changes to the repositorymerge Join two or more development histories togetherrebase Reapply commits on top of another base tipreset Reset current HEAD to the specified stateswitch Switch branchestag Create, list, delete or verify a tag object signed with GPGcollaborate (see also: git help workflows)fetch Download objects and refs from another repositorypull Fetch from and integrate with another repository or a local branchpush Update remote refs along with associated objects'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific subcommand or concept. See 'git help git' for an overview of the system. yongzhiliu@Yongzhis-MacBook-Pro testGit % git testgit --graph git: 'testgit' is not a git command. See 'git --help'. yongzhiliu@Yongzhis-MacBook-Pro testGit % testgit --graph zsh: command not found: testgit yongzhiliu@Yongzhis-MacBook-Pro testGit % git log -graph fatal: unrecognized argument: -graph yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --graph * commit 3f8f40d941149b32fbd7fc9c8473eba1d2c8a831 (HEAD -> master) |\ Merge: 7920ddb 82809a8 | | Author: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> | | Date: Thu Apr 9 07:38:32 2020 +0800 | | | | Merge branch 'f' | | | * commit 82809a80dcc90728a917542593ddb92c16a9da06 (f) | | Author: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> | | Date: Thu Apr 9 07:36:09 2020 +0800 | | | | Branch e | | | * commit af352fad3ca55431b82b7e07d59c67e365bc9d45 | | Author: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> | | Date: Thu Apr 9 07:35:13 2020 +0800 | | | | Branch f | | * | commit 7920ddbd277c6f1506ac57fc97423877fcd81148 |/ Author: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> | Date: Thu Apr 9 07:37:41 2020 +0800 | | master c | * commit b81e0a5c466dd3a6e45308e6e509e396753e1798 | Author: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> | Date: Thu Apr 9 07:29:58 2020 +0800 | | master -b | * commit 1d61d993fb06569f5021bd9d1fda61de2440a94dAuthor: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local>Date: Thu Apr 9 07:28:36 2020 +0800master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --graph --oneline * 3f8f40d (HEAD -> master) Merge branch 'f' |\ | * 82809a8 (f) Branch e | * af352fa Branch f * | 7920ddb master c |/ * b81e0a5 master -b * 1d61d99 master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % cd .. yongzhiliu@Yongzhis-MacBook-Pro NHO % mkdir testGitRebase yongzhiliu@Yongzhis-MacBook-Pro NHO % git init Initialized empty Git repository in /Users/yongzhiliu/Desktop/NHO/.git/ yongzhiliu@Yongzhis-MacBook-Pro NHO % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro NHO % git add . warning: adding embedded git repository: testGit hint: You've added another git repository inside your current repository. hint: Clones of the outer repository will not contain the contents of hint: the embedded repository and will not know how to obtain it. hint: If you meant to add a submodule, use: hint: hint: git submodule add <url> testGit hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached testGit hint: hint: See "git help submodule" for more information. yongzhiliu@Yongzhis-MacBook-Pro NHO % rm .git rm: .git: is a directory yongzhiliu@Yongzhis-MacBook-Pro NHO % rm -rf .git/ yongzhiliu@Yongzhis-MacBook-Pro NHO % ls Screen Shot 2020-03-31 at 3.22.27 PM.png Screen Shot 2020-03-31 at 4.32.48 PM.png index.txt Screen Shot 2020-03-31 at 3.39.19 PM.png Screen Shot 2020-03-31 at 4.44.38 PM.png testGit Screen Shot 2020-03-31 at 3.59.35 PM.png Screen Shot 2020-03-31 at 4.54.39 PM.png testGitRebase yongzhiliu@Yongzhis-MacBook-Pro NHO % cd testGit yongzhiliu@Yongzhis-MacBook-Pro testGit % ls f.txt index.txt yongzhiliu@Yongzhis-MacBook-Pro testGit % git log --oneline 3f8f40d (HEAD -> master) Merge branch 'f' 7920ddb master c 82809a8 (f) Branch e af352fa Branch f b81e0a5 master -b 1d61d99 master -a yongzhiliu@Yongzhis-MacBook-Pro testGit % cd .. yongzhiliu@Yongzhis-MacBook-Pro NHO % cd testGitRebase yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git init Initialized empty Git repository in /Users/yongzhiliu/Desktop/NHO/testGitRebase/.git/ yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % ls index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit "master a" error: pathspec 'master a' did not match any file(s) known to git yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m "master a" [master (root-commit) a42a277] master aCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+)create mode 100644 index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline a42a277 (HEAD -> master) master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m 'master b' [master ce0d522] master bCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline ce0d522 (HEAD -> master) master b a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout f error: pathspec 'f' did not match any file(s) known to git yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout -b f Switched to a new branch 'f' yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi f.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi f.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit 'branch -f' error: pathspec 'branch -f' did not match any file(s) known to git yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m 'branch -f' [f 2d75d01] branch -fCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+)create mode 100644 f.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline 2d75d01 (HEAD -> f) branch -f ce0d522 (master) master b a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi f.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m "branch f" [f 56e5ce1] branch fCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline 56e5ce1 (HEAD -> f) branch f 2d75d01 branch -f ce0d522 (master) master b a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout master Switched to branch 'master' yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout f M index.txt Switched to branch 'f' yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout -b f fatal: A branch named 'f' already exists. yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout f M index.txt Already on 'f' yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline 56e5ce1 (HEAD -> f) branch f 2d75d01 branch -f ce0d522 (master) master b a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout master 'M index.txt Switched to branch 'master' yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline ce0d522 (HEAD -> master) master b a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add .. fatal: ..: '..' is outside repository yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m 'master c' [master 31fefca] master cCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline 31fefca (HEAD -> master) master c ce0d522 master b a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout f Switched to branch 'f' yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git rebase master First, rewinding head to replay your work on top of it... Applying: branch -f Applying: branch f yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline d05c693 (HEAD -> f) branch f 7c4e520 branch -f 31fefca (master) master c ce0d522 master b a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --graph --oneline * d05c693 (HEAD -> f) branch f * 7c4e520 branch -f * 31fefca (master) master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git checkout master Switched to branch 'master' yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --graph --oneline * 31fefca (HEAD -> master) master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git merge f Updating 31fefca..d05c693 Fast-forwardf.txt | 2 ++1 file changed, 2 insertions(+)create mode 100644 f.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --graph --oneline * d05c693 (HEAD -> master, f) branch f * 7c4e520 branch -f * 31fefca master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m 'master hello' [master a1d534a] master helloCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 2 insertions(+) yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m 'master world' [master d29fd00] master worldCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline --graph * d29fd00 (HEAD -> master) master world * a1d534a master hello * d05c693 (f) branch f * 7c4e520 branch -f * 31fefca master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git rebase -i HEAD~~ error: cannot 'fixup' without a previous commit You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'. Or you can abort the rebase with 'git rebase --abort'. yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline --graph * d05c693 (HEAD, f) branch f * 7c4e520 branch -f * 31fefca master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % less index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m 'master hello' [detached HEAD 61b5da9] master helloCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 2 insertions(+) yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % vi index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git add . yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git commit -m 'master world' [detached HEAD 0b8b2ab] master worldCommitter: Yongzhi Liu <yongzhiliu@Yongzhis-MacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file:git config --global --editAfter doing this, you may fix the identity used for this commit with:git commit --amend --reset-author1 file changed, 1 insertion(+) yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline --graph * 0b8b2ab (HEAD) master world * 61b5da9 master hello * d05c693 (f) branch f * 7c4e520 branch -f * 31fefca master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git rebase -i HEAD~~ fatal: It seems that there is already a rebase-merge directory, and I wonder if you are in the middle of another rebase. If that is the case, please trygit rebase (--continue | --abort | --skip) If that is not the case, pleaserm -fr ".git/rebase-merge" and run me again. I am stopping in case you still have something valuable there.yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % rm -fr ".git/rebase-merge dquote> dquote> dquote> " yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline --graph * 0b8b2ab (HEAD) master world * 61b5da9 master hello * d05c693 (f) branch f * 7c4e520 branch -f * 31fefca master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git rebase -i HEAD~~ fatal: It seems that there is already a rebase-merge directory, and I wonder if you are in the middle of another rebase. If that is the case, please trygit rebase (--continue | --abort | --skip) If that is not the case, pleaserm -fr ".git/rebase-merge" and run me again. I am stopping in case you still have something valuable there.yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % rm -fr ".git/rebase-merge" yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % rm -fr ".git/rebase-merge" yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git rebase -i HEAD~~ Successfully rebased and updated detached HEAD. yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git log --oneline --graph * 35c96ae (HEAD) master hello * d05c693 (f) branch f * 7c4e520 branch -f * 31fefca master c * ce0d522 master b * a42a277 master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % less index.txt yongzhiliu@Yongzhis-MacBook-Pro testGitRebase % git reflog 35c96ae (HEAD) HEAD@{0}: rebase -i (fixup): master hello 61b5da9 HEAD@{1}: rebase -i (start): checkout HEAD~~ 0b8b2ab HEAD@{2}: commit: master world 61b5da9 HEAD@{3}: commit: master hello d05c693 (f) HEAD@{4}: rebase -i (start): checkout HEAD~~ d29fd00 (master) HEAD@{5}: commit: master world a1d534a HEAD@{6}: commit: master hello d05c693 (f) HEAD@{7}: merge f: Fast-forward 31fefca HEAD@{8}: checkout: moving from f to master d05c693 (f) HEAD@{9}: rebase finished: returning to refs/heads/f d05c693 (f) HEAD@{10}: rebase: branch f 7c4e520 HEAD@{11}: rebase: branch -f 31fefca HEAD@{12}: rebase: checkout master 56e5ce1 HEAD@{13}: checkout: moving from master to f 31fefca HEAD@{14}: commit: master c ce0d522 HEAD@{15}: checkout: moving from f to master 56e5ce1 HEAD@{16}: checkout: moving from f to f 56e5ce1 HEAD@{17}: checkout: moving from master to f ce0d522 HEAD@{18}: checkout: moving from f to master 56e5ce1 HEAD@{19}: commit: branch f 2d75d01 HEAD@{20}: commit: branch -f ce0d522 HEAD@{21}: checkout: moving from master to f ce0d522 HEAD@{22}: commit: master b a42a277 HEAD@{23}: commit (initial): master a yongzhiliu@Yongzhis-MacBook-Pro testGitRebase %

總結

以上是生活随笔為你收集整理的Git Rebase vs Merge, GIt Reset vs Revert的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲乱码在线观看 | 黑人精品无码一区二区三区 | 青青草成人影视 | 国产精品一线天粉嫩av | 超碰人人爱| 精品视频亚洲 | 美女aaa| 久久不卡 | 91日批视频| 97精品国产97久久久久久粉红 | a点w片| 国产免费一级视频 | 美女被娇喘流出白 | 亚洲三级成人 | 亚洲无码久久久久 | 91福利一区 | 亚洲一片| 久久久wwww | 亚洲自拍色 | 伊人久久中文 | 亚洲综合无码一区二区 | 在线观看69 | 玖玖在线视频 | 丹丹的呻吟声1一7 | 欧美一级欧美三级 | 少妇人禽zoz0伦视频 | 一区二区三区在线视频观看 | ass亚洲熟妇毛耸耸pics | 浪浪视频污 | 成人h片在线观看 | 亚洲无码精品国产 | 久99热| 成人手机在线播放 | 福利在线视频导航 | 欧美一区二区三区国产 | 封神榜二在线高清免费观看 | 国产一级二级在线 | 99精品黄色| 亚洲精品国产精华液 | 美女啪啪无遮挡 | 神马国产 | 99热亚洲 | 麻豆 国产| 久久久久久久久精 | 国产精品久久久久久人 | 欧美激情一二三区 | 精品人人妻人人澡人人爽牛牛 | 国产精品国产三级国产专区51 | 亚洲美女自拍视频 | 国产九色在线 | 亚洲色图20p | 亚洲成人av免费观看 | 日韩在线色 | 日韩中文电影 | 女仆乖h调教跪趴1v1 | av首页在线观看 | 亚洲伦理网 | 国产成人午夜高潮毛片 | 国产一级片免费观看 | 白丝开裆喷水 | 这里只有精品视频在线观看 | 日本黄色一级 | 成人精品国产免费网站 | 国产精品边吃奶边做爽 | 日本一区二区色 | 亚洲av人人夜夜澡人人 | 日韩在线播放中文字幕 | 久久综合一本 | 成人免费av在线 | 日韩在线观看视频网站 | 白白色视频在线 | 亚洲经典在线观看 | 台湾a级艳片潘金莲 | 性色浪潮| 免费网站在线观看视频 | 精品视频一二三 | 国产免费高清视频 | 糖心vlog精品一区二区 | 国产a级免费 | 色视频网| 天天插天天操天天干 | 中文字幕天堂 | 国产在线黄色 | 国产精品美乳在线观看 | 韩漫动漫免费大全在线观看 | 国产日本欧美在线观看 | 韩国主播青草55部完整 | 超碰神马 | 久久久涩| 欧美伊人 | 日本污视频在线观看 | 秋霞7777鲁丝伊人久久影院 | 99久久久精品免费观看国产 | 亚洲天堂男人天堂 | 国产欧美在线精品日韩 | 乳色吐息免费看 | 国内一区二区 | 久久女同互慰一区二区三区 | 国产色中色 |