简体   繁体   中英

How to “broadcast” a file to all branches in git?

I am working on a project with many branches of different experiment settings. Now I update the "readme.md" and want to copy it to every branch. Instead of switching to every single branch and manually paste it, if there a command to do this in one shot?

This is not possible for Git. To understand why this is not possibe you should read this document on Branches. Basically the idea is that branch in git is just a simple movable pointer that points to a specific commit. Since when You have updated Your readme.MD , You have created a new commit then there is no simple way to "broadcast" those changes to another branches. You would have to move the pointers of all branches to the commit in which You have updated the readme.MD but this would simply make no sense as all branches would make no sense. Probably the fastest way to achieve this is to use cherry-pick command. But this would require You to do this on each branch separately.

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