Install Github's command line utility hub:
$ brew install hub$ git clone https://github.com/github/hub.git
$ cd hub
$ rake install prefix=/usr/localYou need to authorize hub with your Github account using an oAuth token, follow the instructions illustrated in this comment to create the token and provide it to hub
To attach a PR to an existing issue use the following command:
$ hub pull-request -b USERNAME_OF_UPSTREAM_OWNER:UPSTREAM_BRANCH -h YOUR_USERNAME:YOUR_BRANCH URL_TO_ISSUEhub pull-request -i 4Where -i 4 is the issue's id.
Source: Stackoverflow question.
git filter-branch -f --tree-filter 'rm -rf folder/path' HEADsource blog post, Stack Overflow, git-scm
After a git filter-branch you run the git compact command to remove empty directories from history.
git gc --aggressive --prune=nowSource: SO Question.
git clone <git repository A url>
cd <git repository A directory>
git remote rm origin
git filter-branch --subdirectory-filter <dir to move> -- --all
mkdir <dir to move>
mv * <dir to move>
git add .
git commitgit clone <git repository B url>
cd <git repository B directory>
git remote add repo-A-branch <git repository A directory>
git pull repo-A-branch master
git remote rm repo-A-branchmkdir /tmp/mergepatchs
cd ~/repo/org
export reposrc=myfile.c #or mydir
git format-patch -o /tmp/mergepatchs $(git log $reposrc|grep ^commit|tail -1|awk '{print $2}')^..HEAD $reposrc
cd ~/repo/dest
git am /tmp/mergepatchs/*.patch