Skip to content

Commit 683ae9e

Browse files
committed
add rebase instructions to the merge way of catching up main
1 parent a9a3c20 commit 683ae9e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

book/lectures/050-version-control-2.qmd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ What do you think are pros & cons of each of these branching workflows?
337337

338338
### What happens when my feature branch falls behind main?
339339

340+
There are a few ways you can fix this problem.
341+
342+
#### Using merge
343+
340344
> How to catch up a branch that has fallen behind the `main` branch using the command line:
341345
>
342346
> - run `git pull origin main` to pull any changes from the remote version of main that we might not have
@@ -345,6 +349,14 @@ What do you think are pros & cons of each of these branching workflows?
345349
> - run `git push origin <branch>` to push our updated branch to the remote
346350
347351

352+
#### Using rebase
353+
354+
1. Make sure everything is committed in your new branch
355+
2. Move to the main branch: `git switch main`
356+
2. Make sure the main branch is up to date: `git pull origin main`
357+
3. Move back over to your branch: `git switch <branch>`
358+
4. Update the changes from main: `git rebase main`
359+
348360
## Next:
349361

350362
- file and directory structure for data analysis projects

0 commit comments

Comments
 (0)