Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
合并两个git仓库
#! /usr/bin/python
import os
dir1 = "essays"
dir2 = "../tmp"
tmpBranchName = "other"
execCommand = os.system
strCmd1 = "cd %s && git remote add %s %s && git fetch %s \
&& git checkout -b %s %s/master && git checkout master \
&& git merge %s && git branch -d %s && cd .." % (dir1,tmpBranchName,dir2, \
tmpBranchName,tmpBranchName,tmpBranchName,tmpBranchName,tmpBranchName,)
print strCmd1
execCommand(strCmd1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment