@@ -104,6 +104,51 @@ At this point, all the CI tests should be passing. It should be okay for a
104104maintainer to merge your pull request at this point. Pull requests with the
105105``WIP: `` prefix or draft status will not be merged.
106106
107+ Rebasing in branches
108+ --------------------
109+
110+ Sources/References:
111+
112+ - https://docs.github.com/en/get-started/using-git/about-git-rebase
113+
114+ - CC BY 4.0: Docs on this page were sourced from GitHub's open source
115+ docs. We've added some extra content intermixed, including a diagram
116+ showing the flow.
117+
118+ The git rebase command allows you to easily change a series of commits,
119+ modifying the history of your repository. You can reorder, edit, or squash
120+ commits together. Git rebase is typically used to:
121+
122+ 1) Edit previous commit messages
123+ 2) Combine multiple commits into one
124+ 3) Delete or revert commits that are no longer necessary
125+
126+ To rebase all the commits between another branch and the current branch
127+ state, you can enter the following command in your shell (either the
128+ command prompt for Windows, or the terminal for Mac and Linux):
129+
130+ .. code-block :: console
131+
132+ $ git rebase --interactive other_branch_name
133+
134+ When you have an open PR and you want to take the changes that happened in main
135+ and add them back to your PR, you can do the following.
136+
137+ ..
138+ sequenceDiagram
139+ upstream/main->>+feature_branch: git pull --rebase upstream main
140+ feature_branch->>+origin/feature_branch: git push --force
141+ origin/feature_branch->>+upstream/main: pull request
142+
143+ .. image :: https://user-images.githubusercontent.com/74865775/159732897-c4ec72af-e456-4664-948a-5bc5397aa095.jpg
144+
145+ To rebase the last few commits in your current branch, you can enter the
146+ following command in your shell:
147+
148+ .. code-block :: console
149+
150+ $ git rebase --interactive HEAD~7
151+
107152 How to Read the CI
108153------------------
109154
0 commit comments