git remote add coworker git://path/to/coworkers/repo.git
git fetch coworker
git checkout --track coworker/foo
git checkout foo
git pull
Download a patch by adding .patch to the url of the PR or the commit, for example:
https://patch-diff.githubusercontent.com/raw/ampproject/amphtml/pull/19770.patch
https://github.com/ampproject/amphtml/commit/658c9133650e72a087b1ba184486db1fd9b8b047.patch
Save this patch as foo.patch
. On your branch, run:
git apply name-of-file.patch
git checkout their-branch # see pulling someone else's repo above
git checkout -b my-dependent-branch
git rebase -i their-branch
git rebase -i upstream/master
and drop any duplicate commits.
This will reset to commit at hash A.
git checkout -f A -- .
git commit'
Or do
git revert --no-commit HEAD~3..
This reverts the last 2 commits.