synchronize git branch with master, selectively

I know how to “synchronize” two branches (i.e. the gh-pages branch is updated everytime the master is updated).

What I would like is to sinchronize only a certain directory of master to the gh-pages branch. To be clear, that’s what I would like to achieve:

  • How to push changes to github after jenkins build completes?
  • Why does ssh-agent need root access?
  • Pass Environment Variables from Shippable to Docker
  • Eclipse - External JARs and git
  • git repo subdirectory convert to a submodule - should I not commit dir removal and module addition at once?
  • How to organize git repository for android and server code
  • master:

    +-- some
    +-- file
    +-- here
    +-- dist/
        +-- some_other
        +-- dist_file


    +-- some_other
    +-- dist_file

    In other words, I’d like to have gh-pages updated as the dist/ directory of master every time master gets pushed.

    Is it feasible?

  • How to suppress the --show-name (filename) option when git blame?
  • A clean system for github pages with local plugins
  • Converting a local svn repo dump to git
  • Git repo planning questions
  • Visual Studio 2015 git Push to Network Drive
  • Get commit that precedes a fork at Github
  • One Solution collect form web for “synchronize git branch with master, selectively”

    Constructing the commit yourself is easy:

    git commit-tree -p gh-pages -m "" master:dist \
    | xargs git update-ref refs/heads/gh-pages

    Automating that is just a matter of taste. Simplest is to just write a script and run that instead. Hooks are an inbound thing for vetting what you’re doing to your repo; pushing untested repo changes isn’t something git’s really set up to automate. As I recall github doesn’t do hooks at all, so if you want a receive hook on stuff you push there, just make a proxy repo and have the hook do your synch and forward the push.

    Git Baby is a git and github fan, let's start git clone.