简体   繁体   中英

how to push in git repository a files to all remote branches?

I have a local repository that I have cloned from our remote git repository and I have edited a file in this branch. now I need to push this specific file to all remote branches?

how can I do it at one command and not insert it manually to each branch?

If you fixed a file on your local branch, it will be pushed to a single remote branch which is the branch upstream.

If you have many remote branches that needs this fix. You need to merge the commit to all those branches. First locally, and then push the changes.

It has to be done manually, or using some script.

git checkout some_local_branch
git cherry-pick <hash of the fix>
git checkout another_local_branch
git cherry-pick <hash of the fix>
....
git push

The last git push will either push all your branches together or just some branches. That depends on your settings.

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