-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01-07-rebasing-branch.qmd
28 lines (25 loc) · 1.25 KB
/
01-07-rebasing-branch.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Rebasing a branch
## Rebasing a branch
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, fig.align = "center")
```
* Performing a rebase puts the commits you have on your branch on top of the commits from another branch
* We commonly do this when our colleagues have merged PRs into say the `main` branch
* We would then rebase our branch on top of `main`
* A rebase can be performed in GitHub Desktop as follows
* In these screenshots we assume we started working on `branch-1`
* We then made `branch-2` from `branch-1` and made some commits on it
* We then went back to `branch-1` and made some different commits
* We now need to rebase the commits on `branch-2` to be on top of `branch-1`
* Starting on `branch-2`, select *Branch | Rebase current branch...*
```{r}
knitr::include_graphics("img/rebase-01.png")
```
* Or/then from the middle panel select the branch to rebase on top of - select `branch-1` (or select `main` if you are rebasing on top of main) and click *Rebase*
```{r}
knitr::include_graphics("img/rebase-02.png")
```
* Hopefully the rebase will be successful, if there are merge conflicts you will need to resolve those
```{r}
knitr::include_graphics("img/rebase-03.png")
```