'Can github master branch append data from other branch?

I am looking for a way that we have a global file on master branch. Every time when another branch merge to master, this global file will not be written; instead it can append data from another branch into this global file on master.



Solution 1:[1]

There is no simple way, you have to implement it yourself. Merge, restore the file from master before the merge, append new content from another branch. Something like this:

git checkout master
git merge another_branch
git checkout HEAD^1 -- global_file # restore from before merge
git show another_branch:global_file >> global_file # append from another_branch

git add global_file
git commit -m "Append to global_file"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 phd