To rebase your current branch with the develop branch, follow these steps:
-
Fetch all the latest changes from the remote:
git fetch
-
Make sure you're on your feature branch:
git checkout your-branch-name
-
Rebase your branch on top of the develop branch:
git rebase origin/develop
If you encounter merge conflicts during the rebase:
-
Resolve conflicts in your editor, then:
git add .
-
Continue the rebase process:
git rebase --continue
-
If you need to abort the rebase:
git rebase --abort
-
-
Stash your changes:
git stash
-
Rebase with develop:
git checkout your-branch-name git rebase origin/develop
-
Apply your stashed changes:
git stash pop
After rebasing, you'll need to force push your changes since you've rewritten history:
git push --force-with-lease origin your-branch-name
The --force-with-lease
option is safer than --force
as it prevents you from overwritting others' work.