I have a branch that I want to merge to the remote, most up-to-date master
. I have a local, outdated master on my computer. I ran git pull upstream master
, and it retrieved the remote master
, and that was great, exactly what I wanted. Then, without thinking, i accidentally discarded the changes while switching to another branch.
While on my local master, I have run git pull
, and git pull upstream master
many times now, and it always says "Already up to date." when it clearly isn't. At first git pull upstream master
worked just fine, but now it doesn't, and the machine thinks it is up to date when it isn't. How can I make my local master the same as the remote one again?
Well, typically when I have an outdated master locally and want to merge recent changes in a branch (say, my_branch) to master (both locally and remotely), I do the following,
master
branch locally.git pull --rebase origin master
(This pulls down the most up-to-date changes on master locally)my_branch
git pull --rebase origin master
(This updates your local branch against the most recent master on remote. You may need to resolve the conflicts here (if any that is))master
branch locally, again.git merge my_branch
git push origin master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With