Merge changes made in the "master" branch into your development branch.

raielly

raielly

Posted on March 4, 2023

Merge changes made in the "master" branch into your development branch.

If we needs to stay in sync with the latest changes made in "master", while also retaining a complete record of all changes made. Let's try to use rebasing.

git checkout master
git pull --rebase
git checkout branch_name
git rebase master
git push -f origin branch_name
Enter fullscreen mode Exit fullscreen mode

Note: Don't forget to backup first your branch when doing changes

git branch branch_name-bkp
Enter fullscreen mode Exit fullscreen mode

If there's any conflict arise, use this command as needed to fix the issue based on the situation and the hints provided by git.

git rebase --continue
git rebase --skip
git mergetool
Enter fullscreen mode Exit fullscreen mode

Please continue this process until all conflicts are resolved.

At this point, our branch should be rebased and aligned with the "master" branch, and the remote should also be updated. When checking the Git log, there should be no instances of "behind" or "ahead".

💖 💪 🙅 🚩
raielly
raielly

Posted on March 4, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Github and Git Workflow
github Github and Git Workflow

October 13, 2024

A Beginner’s Guide to GitHub
github A Beginner’s Guide to GitHub

October 19, 2024

Complete Git Cheat sheet
webdev Complete Git Cheat sheet

September 25, 2024

Forks in GitHub
git Forks in GitHub

September 19, 2024