I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local branch.
I've tried
git pull --rebase origin configUpdate
but it hasn't grabbed the latest changes - how can I merge the two? (also for bonus points what did I do with the pull --rebase
command?)
Switch to your local branch
> git checkout configUpdate
Merge remote master to your branch
> git rebase master configUpdate
In case you have any conflicts, correct them and for each conflicted file do the command
> git add [path_to_file/conflicted_file] (e.g. git add app/assets/javascripts/test.js)
Continue rebase
> git rebase --continue
I found out it was:
$ git fetch upstream
$ git merge upstream/master
git rebase didn't seem to work for me. After git rebase, when I try to push changes to my local branch, I kept getting an error ("hint: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again.") even after git pull. What finally worked for me was git merge.
git checkout <local_branch>
git merge <master>
If you are a beginner like me, here is a good article on git merge vs git rebase. https://www.atlassian.com/git/tutorials/merging-vs-rebasing
Source: Stackoverflow.com