git: stash 分支上的详细提交

标签 git

我想知道这在 git 中是否可行。所以我有主分支。我会不时地为功能开发创建一个分支。完成后,我会将其 merge 回 master。现在通常侧分支上的所有提交历史都会显示在主分支中。有没有办法让所有提交在主服务器上显示为一个?

最佳答案

$ git checkout master
$ git merge --squash <branch>

来自docs (强调我的):

--squash
--no-squash
Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to cause the next git commit command to create a merge commit). This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).

With --no-squash perform the merge and commit the result. This option can be used to override --squash.

关于git: stash 分支上的详细提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31717273/

相关文章:

git - Visual Studio 2017 Enterprise + TFS 2018 + Git Clone = 无法获取本地颁发者证书

c++ - Doxygen 用于使用 git 管理的项目?

git - 如何让操作系统认为一个目录是另一个目录?

.net - 用户如何从浏览器使用 GIT

git - 关于在工作流中使用 TortoiseGit 的任何好的教程?

iphone - zxing 的 git 子模块(iPhone 版本)?

git - 如何将本地存储库推送到远程使用 "SourceTree"

android - 在 Android Studio 中将电子邮件添加到 GitHub 提交

git - 为什么 bitbucket 分支项目会 checkout 两次?

javascript - 缺少一些试图将 Bootstrap 作为本地 git 子模块包含到 meteor 中的东西