I have currently one of the project it contain more branches. master branch not yet merger long time. So i want switched to master with latest code.
Can you please g
Do you want to merge a 'develop' branch into master?
git checkout master
git merge develop
Or do you want to merge the changes from master into your development branch?
git checkout develop
git merge master
If I understand your English correctly, you don't want to merge your changes back into master, but just reset master to point to the latest commit in your currently checked out branch? To do this, use:
git branch -f master
If you want to take some commits from branch
to master
, you could use cherry-picking.
This takes only certain commits from branch
to master
, but is – of course – not guaranteed that no conflicts occur.
See my answer to Managing hotfixes when develop branch is very different from master?
However, if you want to take all commits from branch
into master
, you won't get around merging and resolve conflicts (unless you git reset --hard other-branch
the master
branch as described – and discouraged – by Mark).
In IntelliJ at least, you can do the following:
This turns master into your current branch. The history for master is preserved. I'm sure there is a git command line equivalent.