We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
通过rebase命令将多个commit压缩成一个:git rebase -i HEAD~[number_of_commits] 如果想要压缩最后两个commit,即将最后三个提交合并成一个,可以通过命令: git rebase -i HEAD~3 终端执行后,会输出:
git rebase -i HEAD~[number_of_commits]
git rebase -i HEAD~3
pick 16a9a47 update3 pick a7186d8 update2 pick 7b16b28 update1 。。。
将要压缩的commit改成从pick改成squash或者s,然后保存退出。
pick 16a9a47 update3 s a7186d8 update2 s 7b16b28 update1 。。。
通过git status,可以看到有一个提交,即将三个commit合并成一个的commit, 提交远程:git push -f 注意:这里多个commit合并是有记录的,可以看出是由多个提交合并成的。
git push -f
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Git合并最新的连续的多个提交
通过rebase命令将多个commit压缩成一个:
git rebase -i HEAD~[number_of_commits]
如果想要压缩最后两个commit,即将最后三个提交合并成一个,可以通过命令:
git rebase -i HEAD~3
终端执行后,会输出:
将要压缩的commit改成从pick改成squash或者s,然后保存退出。
通过git status,可以看到有一个提交,即将三个commit合并成一个的commit,
提交远程:
git push -f
注意:这里多个commit合并是有记录的,可以看出是由多个提交合并成的。
本地代码关联远程分支
此时,可以提交代码到远程分支了,当然这种操作只适合远程分支没有代码的情况下。
The text was updated successfully, but these errors were encountered: