Git Tips¶
How to create a clean PR¶
In certain scenarios, it becomes necessary to refine commit history and generate a pristine pull request for the target branch. While Git rebase is a useful tool for this purpose, its application can be less straightforward, especially when the working branch incorporates changes from other pull requests.
To address this, a practical workaround involves resetting all commits on the base branch. Here's a simple guide to follow:
- Confirm that you are on the working branch with a cluttered commit history.
- Create a new branch:
- Pull Changes from the Base Branch:
-
Resolve any merge conflicts and commit the changes.
-
Reset all commits based on the base branch (usually the default repository branch):
-
For instance: