简体   繁体   中英

How do I force a git merge

I have two branches, master and a local branch. I want to merge changes made from master to my local branch. I know the changes in master are more recent than the ones in my local branch, but when I go to the local branch and write git merge master , the response is Already up-to-date . I may have tricked my local branch into believing it is more current than master, I'm not sure how.

How can I force a merge conflict? Most of the files in master are more recent than the ones in local?

Fetch the remote changes before merge:

git checkout local_branch
git fetch origin
git merge origin/master 

I assume that you've used origin as the name for the remote.

I m considering that you have the latest code in your master and it is in your workstation

 git checkout local;
 git merge -s ours master;

Maybe you want rebase instead of merge?

Checkout local branch. Then:

git rebase master

Rebase is usually what you want when you're thinking about merge.

Git workflow and rebase vs merge questions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM