- Git - Home
- Git - Version Control
- Git - Basic Concepts
- Git - Command Line
- Git - Installation
- Git - First Time Setup
- Git - Basic Commands
- Git - Getting Help
- Git - Tools
- Git - Cheat Sheet
- Git - Terminology
- Git - Life Cycle
- Git - Get a Repository
- Git - Adding New Files
- Git - Recording Changes
- Git - Viewing Commit History
- Git Branching
- Git - Branches in a Nutshell
- Git - Creating a New Branch
- Git - Switching Branches
- Git - Branching and Merging
- Git - Merge Conflicts
- Git - Managing Branches
- Git - Branching Workflows
- Git - Remote Branches
- Git - Tracking Branches
- Git - Rebasing
- Git - Rebase vs. Merge
- Git - Squash Commits
- Git Operations
- Git - Clone Operation
- Git - Tagging Operation
- Git - Aliases Operation
- Git - Commit Operation
- Git - Stash Operation
- Git - Move Operation
- Git - Rename Operation
- Git - Push Operation
- Git - Pull Operation
- Git - Fork Operation
- Git - Patch Operation
- Git - Diff Operation
- Git - Status Operation
- Git - Log Operation
- Git - Head Operation
- Git - Origin Master
- Git Undoing
- Git - Undoing Changes
- Git - Checkout
- Git - Revert
- Git - Reset
- Git - Restore Operation
- Git - Rm
- Git - Switch Operation
- Git - Cherry-pick
- Git - Amend
- Git on the Server
- Git - Local Protocol
- Git - Smart HTTP Protocol
- Git - Dumb HTTP Protocol
- Git - The SSH Protocol
- Git - The Git Protocol
- Git - Getting Git on a Server
- Git - Setting up the Server
- Git - Daemon
- Git - GitWeb
- Git - GitLab
- Git - Third Party Hosted Options
- Distributed Git
- Git - Distributed Workflows
- Git - Contributing to a Project
- Git - Maintaining a Project
- Customizing Git
- Git - Configuration
- Git - Hooks
- Git - Attributes
- Git - Init
- Git - Commit
Git - Merge vs. Rebase
Commit History: Accuracy vs. Clarity
After experiencing both merging and rebasing in action, we may be wondering which is preferable.
But let's consider why commit history matters before making a decision.
The Preservers of History:
According to one perspective.
Our commit history is an accurate account of what occurred.
Similar to a historical record, it is significant for its accuracy and should not to be altered.
From this perspective, altering history amounts to rewriting the past.
Messy merge commits are a fact of life and should remain.
Another perspective.
Our commit history as a story of our project's development.
We wouldn't release a rough draft, so why display messy work?
It's critical to record errors and dead ends during development.
However, a brief story that follows our work from beginning to end has greater effect when shared.
Before their commits are merged into the main branch, members of this group rework them using tools like rebase and filter-branch.
They convey the story in a style that will be most appropriate for readers in the future, thereby managing the development story.
This method makes sure that the history is clear and linear, which facilitates understanding of the project's development by others.
The question arises: Should we merge or rebase?
There's no straightforward answer.
There are many ways to change history using Git, but each team and project is special.
With knowledge of both approaches, we can make a smart choice.
Conclusion
Of course, we can utilize both! Before pushing, use rebase to clean up our local work.
However, do not rebase anything that has already been shared with others.