简体   繁体   中英

How Can I replace/copy all file and folder from one branch to another existing branch in GIT

I have 3 branch -> Master , develop and admit_card . I had created before admit_card from the develop branch. I always made changes on admit_card branch and merge it into develop .

But suddenly I have changed some more files and also deleted folder form the develop branch. And now I want to copy/keep updated to the admit_card branch like develop branch (By deleting folders and files).

I merged it with develop branch. It is merging with develop branch properly. But the issue is the folders and files I deleted from the develop branch is still showing into the admit_card branch.

here is the merge develop branch with admit_card branch.

git checkout admit_card
git merge develop

what should I do please? How can I copy/replace exact develop branch to admit_card branch? Can anybody please help me?

Thank you

I think rebase is better approach here.

On your admit_card branch run

git rebase develop

This will, in effect, set your admit_card branch to the contents of the develop branch and then play back any additional commits on the admit_card branch on top of this. You might have merge conflicts if you have touched the same files in both the branches. Once you resolve the merge conflicts, your admit_card branch will be a clean topic branch on top of your develop branch again.

Run git rebase --abort if you get stuck with the merge to revert back to how things were.

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