Skip to content

Commit

Permalink
A Deeper Look at Git: Expand on squash definition (#28738)
Browse files Browse the repository at this point in the history
  • Loading branch information
SumonGFC authored Sep 3, 2024
1 parent b07481f commit 5e394e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git/intermediate_git/a_deeper_look_at_git.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ So let's edit our commit by typing `git commit --amend`, fixing the typo in the

#### Squashing commits

Using `squash` for our commits is a very handy way of keeping our Git history tidy. It's important to know how to `squash`, because this process may be the standard on some development teams. Squashing makes it easier for others to understand the history of your project. What often happens when a feature is merged, is we end up with some visually complex logs of all the changes a feature branch had on a main branch. These commits are important while the feature is in development, but aren't really necessary when looking through the entire history of your main branch.
Using `squash` for our commits is a very handy way of keeping our Git history tidier by combining multiple commits into one. It's important to know how to `squash`, because this process may be the standard on some development teams. Squashing makes it easier for others to understand the history of your project. What often happens when a feature is merged, is we end up with some visually complex logs of all the changes a feature branch had on a main branch. These commits are important while the feature is in development, but aren't really necessary when looking through the entire history of your main branch.

Let's say we want to `squash` the second commit into the first commit on the list, which is `Create first file`. First let's rebase all the way back to our root commit by typing `git rebase -i --root`. Now what we'll do is `pick` that first commit, as the one which the second commit is being `squash`ed into:

Expand Down

0 comments on commit 5e394e6

Please sign in to comment.