Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

copy code from one repo to another git

# checkout repository A
git checkout git@github.com:username/repoA.git
# cd into old repository
cd repoA
# change remote origin to the newely created repo (exemple repoB)
git remote set-url origin git@github.com:username/repoB.git
# push branch into repoB
git push origin <branch>
# cd into new repository and pull branch
git checkout origin <branch>
# finally don't forget to reset origin for repoA
git remote set-url origin git@github.com:username/repoA.git
 
PREVIOUS NEXT
Tagged: #copy #code #repo #git
ADD COMMENT
Topic
Name
3+7 =