I have a lot git branches.
There's a directory/folder in which I keep apk files.
But whenever I add a apk/file and push it
(1. git add, 2. git commit -m "", 3. git push)
,
It gets pushed to the local branch in which i'm working.
Instead of this I want to push that file to all branches, so how can I do that?
Also already in that folder there are lot of apk files which are present only for that particular branch.
So how can I make them available for all branch(i.e. push all those apk files to all branches)?
By default, you commit into a branch, and push to a remote repo all your commits.
If you want that commit (assuming it only includes your new file) to be visible in all other branches, one way would be to
git cherry-pick
that commit to the other branches.If you just created that commit into
master
, you would switch branch and cherry-pick (the commit on top of)master
:However, this is not recommended if you intent to merge that other branch back to master at some point, as that would introduce a duplicate commit.
To read -- much more -- on that topic, see "git commit to all branches".
Merging your current branch to other branches is better (see "do a
git cherry-pick
in multiple branches"), but not always possible/wanted, as it would merge all commits from one branch to the other.An actual proper solution would simply be to checkout to another branch and add your file (again there), make a commit (again) there.
And repeat for the other branches.