Search⌘ K
AI Features

Squashes the Commits

Understand how to squash multiple commits into one, use force push to override remote history in a bare repository, and explore challenges when collaborators pull and merge changes, leading to complex commit histories.

Now you (as Alice) are going to squash the commits like you did in the previous chapter.

1	cd ../lgthw_bare_repo_alice
2	git rebase -i $(git rev-list --max-parents=0 HEAD) HEAD

Edit the final commit message so it looks like this:

commits:1-10

Now that it is done, you need to move the master branch pointer to the squashed commit:

3	git branch -f master
4	git checkout master

...