简体   繁体   中英

Git making files in one branch same as another

When I want to push changes into my remote acceptance environment, I want to make my test branch identical to master in git before merging in the files from the new dev branch.

What is the easiest way to make the "test" branch a snapshot of master and merge in changes from a new branch?

如果您的更改正在test中并且您想更新本地master ,只需 checkout master ,然后执行git merge test

If the current (or old) commit test is at is not important to you (or anyone else).

You can simply do

$ git checkout test
$ git reset --hard master
$ # In case your local master is not up-to-date use origin/master

This will move the pointer of test to the current commit master is pointing at.

git fetch && git rebase origin/master && git push origin <your-branch> -f

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