while working on my feature branch, I found that someone made changes to the master branch. The feature branch which I'm currently working on needs to sync with the master branch. Tried to use git rebase, but it doesn't work (expected to see some file conflicts).
There are many modifications to the current feature files. Do I need to git add and commit (but don't git push) these modifications before git rebase?
You can follow the following steps:
git checkout master
git pull --rebase origin master
[To Update branch with remote repo]git checkout feature
git rebase master
git add <file_name>/ git add .
git rebase --continue
git rebase --skip
if neededgit push --force-with-lease origin feature
(safer way of force push) OR git push -f origin feature
FOR REFERENCE: https://gitexplorer.com/
You shouldn't need to rebase at all. In fact, it's my opinion that rebasing is something you should do if you fully understand the possible consequences (rebasing can rewrite logs which is not usually a good idea for auditing changes, merging does not).
You can simply git fetch ; git pull origin master
git fetch ; git pull origin master
to bring in their changes, then fix any merge conflicts caused by that.
You need to rebase master:
git checkout master
git pull master
git checkout feature-branch
git rebase master
Your feature-branch commits will be ahead of last commit in master branch.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.