git and merging with changes outside the repo

Tech Notes

Working with other developers on projects has often resulted in large manual merges of parallel work. At the beginning this is straightforward as there are a small number of files and a short history. Things change as projects progress and I've sometimes spent hours on small updates. Here is a git recipe for merging in those changes more easily. Scenario 1. No new changes in our repo computer:repo user$ git checkout -b import computer:repo user$ cp -R ../new-work/* ./ computer:repo user$ git add . computer:repo user$ git commit -m "Merging in new work" computer:repo user$ git checkout master computer:repo user$ git merge import Scenario 2. Changes in our repo Figure out what the sha of the last common commit was and computer:repo user$ git checkout [sha1 of the old commit] -b import computer:repo user$ cp -R ../new-work/* ./ computer:repo user$ git add . computer:repo user$ git commit -m "Merging in new work" computer:repo user$ git checkout master computer:repo user$ git merge import Via stackoverflow