Skip to content

Commit 6f5c55b

Browse files
committed
Merge pull request #260 from anton-trunov/fix-redundant-options
git merge use: --squash doesn't need --no-commit
2 parents f888a88 + 9b4092e commit 6f5c55b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

book/05-distributed-git/sections/contributing.asc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,15 +600,15 @@ You start a new branch based off the current `origin/master` branch, squash the
600600
[source,console]
601601
-----
602602
$ git checkout -b featureBv2 origin/master
603-
$ git merge --no-commit --squash featureB
603+
$ git merge --squash featureB
604604
# (change implementation)
605605
$ git commit
606606
$ git push myfork featureBv2
607607
-----
608608

609-
The `--squash` option takes all the work on the merged branch and squashes it into one non-merge commit on top of the branch you're on.
610-
The `--no-commit` option tells Git not to automatically record a commit.
611-
This allows you to introduce all the changes from another branch and then make more changes before recording the new commit.
609+
The `--squash` option takes all the work on the merged branch and squashes it into one changeset producing the repository state as if a real merge happened, without actually making a merge commit.
610+
This means your future commit will have one parent only and allows you to introduce all the changes from another branch and then make more changes before recording the new commit.
611+
Also the `--no-commit` option can be useful to delay the merge commit in case of the default merge process.
612612

613613
Now you can send the maintainer a message that you've made the requested changes and they can find those changes in your `featureBv2` branch.
614614

book/07-git-tools/sections/subtree-merges.asc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ $ git pull
6666
----
6767

6868
Then, we can merge those changes back into our `master` branch.
69-
To pull in the changes and prepopulate the commit message, use the `--squash` and `--no-commit` options, as well as the recursive merge strategy's `-Xsubtree` option. (The recursive strategy is the default here, but we include it for clarity.)
69+
To pull in the changes and prepopulate the commit message, use the `--squash` option, as well as the recursive merge strategy's `-Xsubtree` option. (The recursive strategy is the default here, but we include it for clarity.)
7070

7171
[source,console]
7272
----
7373
$ git checkout master
74-
$ git merge --squash -s recursive -Xsubtree=rack --no-commit rack_branch
74+
$ git merge --squash -s recursive -Xsubtree=rack rack_branch
7575
Squash commit -- not updating HEAD
7676
Automatic merge went well; stopped before committing as requested
7777
----

0 commit comments

Comments
 (0)