I have a branch called dmgr2 (development) and I want to pull from the master branch (live site) and incorporate all the changes into my development branch. is there a better way to do this? here is what I had planned on doing, after committing changes:
git checkout dmgr2
git pull origin master
this should pull the live changes into my development branch, or do I have this wrong?
git pull origin master --allow-unrelated-histories
You might want to use this if your histories doesnt match and want to merge it anyway..
refer here
Situation: Working in my local branch, but I love to keep-up updates in the development branch named dev
.
Solution: Usually, I prefer to do :
git fetch
git rebase origin/dev
This Worked for me. For getting the latest code from master to my branch
git rebase origin/master
Scenario:
I have master updating and my branch updating, I want my branch to keep track of master with rebasing, to keep all history tracked properly, let's call my branch Mybranch
Solution:
git checkout master
git pull --rebase
git checkout Mybranch
git rebase master
git push -f origin Mybranch
(correction to last stage, in courtesy of Tzachi Cohen, using "-f" forces git to "update history" at server)
now branch should be aligned with master and rebased, also with remote updated, so at git log there are no "behind" or "ahead", just need to remove all local conflict *.orig files to keep folder "clean"
Source: Stackoverflow.com