我们会将最后两个提交压缩到第一个提交中,所以将它们的 pick 命令更改为 squash : pick 0832e96 Add file1 squash c16cbc6 Add file2 squash 6afa3ac Add file3 保存并退出,git 将打开编辑器,通知我们将要合并三个提交: #This is a combination of 3 commits. #This is the 1st commit message: Add fil...
p, pick <commit> = use commit r, reword <commit>:编辑提交消息 e, edit <commit>:停下来修改 s, squash <commit>:融入之前的承诺 f, fixup <commit>:例如"squash",丢弃这个提交的日志消息 x, exec :使用shell运行command(该行的其余部分) b, break:在此停止(稍后使用'git rebase --continue'继续...
* 247572e (HEAD -> feature/JIRA123-amend-test) feat: [JIRA123] add feature 1.2 and 1.3* 119f86e feat: [JIRA123] add feature 1.1* 5dd0ad3 feat: [JIRA123] add feature 1* c69f53d (origin/main, origin/feature/JIRA123-amend-test, origin/HEAD, main) Initial commit 知道这个技巧...
8 # p, pick <commit> = use commit 9 # r, reword <commit> = use commit, but edit the commit message 10 # e, edit <commit> = use commit, but stop for amending 11 # s, squash <commit> = use commit, but meld into previous commit 12 # f, fixup <commit> = like "squash", ...
10 # e, edit <commit> = use commit, but stop for amending 11 # s, squash <commit> = use commit, but meld into previous commit 12 # f, fixup <commit> = like "squash", but discard this commit's log message 13 # x, exec = run command (the rest of the line) using shell...
* c69f53d (origin/main, origin/feature/JIRA123-amend-test, origin/HEAD, main) Initial commit 1. 2. 3. 4. 假设我们要修改最后一个 log message,就可以使用下面命令: git commit --amend -m "feat: [JIRA123] add feature 1.2 and 1.3" ...
# 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 = run command (the rest of the line) using shell # b, break...
# Rebase 41a72e6..7b36971 onto 41a72e6 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit ...
The recommended way to create commits with squash markers is by using the--squash,--fixup,--fixup=amend:or--fixup=reword:options ofgit-commit[1], which take the target commit as an argument and automatically fill in the title of the new commit from that. ...
Thes"squash" command is where we see the true utility of rebase. Squash allows you to specify which commits you want to merge into the previous commits. This is what enables a "clean history." During rebase playback, Git will execute the specified rebase command for each commit. In the ...