Merge upstream changes
Problem
I keep a fork of my personal dotfiles for my work environment. The personal dotfiles repo changes fairly often and I want to keep the work dotfiles up-to-date with upstream.
Solution
The work dotfiles are kept in their own repo, and the personal dotfiles repo is a remote and checked out as a branch.
Building on Jason Rudolph's Git Tip: How to "Merge" Specific Files from Another Branch I chose only to merge files and not cherry-pick changes.
Because the work repo does have some files the personal repo has not I (normally )only want to merge changed and added files
git checkout upstream $(git diff --name-status master..upstream | grep ^[MA] | awk '{ print $2 }' | tr '\n' ' ')
A final check that no work related configuration is lost
git diff --cached
Written by Oliver Schrenk
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#