Commit History and Interactive Rebase
Understanding Commit History
Git's log
command offers a view of the commit history. It displays a list of commits in reverse chronological order, showcasing commit messages, authors, and commit hashes. Participants can enter git log
in the terminal to view the commit history of a repository, gaining insights into the project's development timeline.
Interactive Rebase Exercise
Let's explore the functionality of interactive rebase, focusing on squashing commits, changing messages, deleting, and picking commits in a simple exercise.
-
Squashing Commits:
- Demonstrate squashing multiple commits into a single one using
git rebase -i HEAD~N
, whereN
is the number of commits to include.
- Demonstrate squashing multiple commits into a single one using
-
Changing Commit Messages:
- Show how to alter commit messages during an interactive rebase by marking commits as
reword
.
- Show how to alter commit messages during an interactive rebase by marking commits as
-
Deleting Commits:
- Guide participants on how to delete specific commits from the commit history using
git rebase -i
.
- Guide participants on how to delete specific commits from the commit history using
-
Picking Commits:
- Illustrate how to pick specific commits and rearrange their order using
git rebase -i
.
- Illustrate how to pick specific commits and rearrange their order using