Go to the
git-tutorial/tutorial7 directory you previously downloaded.
When you examine the history of this repository, it will look like the following:
We will squash commits from the
issue1 branch into a single commit and then merge it into the main branch.
Switch to the main branch, and execute a merge with the
--squash option like below.
$ git checkout main
Switched to branch 'main'
$ git merge --squash issue1
CONFLICT (content): Merge conflict in sample.txt
Squash commit -- not updating HEAD
Automatic merge failed; fix conflicts and then commit the result.
Git will detect a conflict. We must manually resolve it in the
sample.txt file and commit the change.
$ git add sample.txt
$ git commit
[main 0d744a7] Conflicts: sample.txt
1 files changed, 4 insertions(+), 0 deletions(-)
We now have a new commit added to the main branch, which includes all of the commits in the
You can verify the new change in the revision history using the git log command.