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
If you want to have in master exactly the same files state as in other_branch and save history - do the following (and note the period at the end):
git checkout master
git checkout other_branch .
Now you will have a full copy of other_branch in current master (it is softer than reset), not yet committed. Then make a regular commit:
git add --all
git commit -m "* copy other_branch to master working tree"
Note: untracked (unindexed) files (directories) from other_branch will remain, if they are not tracked by master. To remove those untracked files (directories):
git clean -fd
See How to remove local (untracked) files from the current Git working tree? for more details.