raielly
Posted on March 4, 2023
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
Note: Don't forget to backup first your branch when doing changes
git branch branch_name-bkp
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
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
Posted on March 4, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.