git - How do I add a repository to another repository? -



git - How do I add a repository to another repository? -

yesterday created github repository , today found out advisor created github repository. best way add together repository repository without massively screwing things up? have massively screwed things in past want create sure. may have screwed things trying follow instructions on stackoverflow post.

right seems have 2 branches, , typing "git checkout master" gives me files, while typing "git checkout tmp_branch" gives me files. i'd add together files repository , utilize 1 on, , maybe delete repository.

so far i've tried is

me@server:~/rootdir$ git remote add together origin https://github.com/him/his_repo.git fatal: remote origin exists. me@server:~/rootdir$ git remote add together his_repo https://github.com/him/his_repo.git me@server:~/rootdir$ git force -u his_repo master username 'https://github.com': me@gmail.com password 'https://me@gmail.com@github.com': https://github.com/him/his_repo.git ! [rejected] master -> master (non-fast-forward) error: failed force refs 'https://github.com/him/his_repo.git' hint: updates rejected because tip of current branch behind hint: remote counterpart. merge remote changes (e.g. 'git pull') hint: before pushing again. hint: see 'note fast-forwards' in 'git force --help' details. me@server:~/rootdir$ git pull his_repo username 'https://github.com': me@gmail.com password 'https://me@gmail.com@github.com': warning: no mutual commits remote: counting objects: 13, done. remote: compressing objects: 100% (10/10), done. remote: total 13 (delta 0), reused 10 (delta 0) unpacking objects: 100% (13/13), done. https://github.com/him/his_repo * [new branch] master -> his_repo/master asked pull remote 'his_repo', did not specify branch. because not default configured remote current branch, must specify branch on command line. me@server:~/rootdir$ git checkout -b tmp_branch his_repo/master warning: unable rmdir mysubdir: directory not empty branch tmp_branch set track remote branch master repo. switched new branch 'tmp_branch' me@server:~/rootdir$ git checkout -b origin/master switched new branch 'origin/master' me@server:~/rootdir/subdir$ git checkout -b master fatal: branch named 'master' exists. me@server:~/rootdir/subdir$ git checkout master checking out files: 100% (2409/2409), done. switched branch 'master' me@server:~/rootdir$ git checkout tmp_branch warning: unable rmdir mysubdir: directory not empty switched branch 'tmp_branch' me@server:~/rootdir$ git mv * tmp_branch/* fatal: destination 'tmp_branch/*' not directory me@server:~/rootdir$ cd .. me@server:~/rootdir$ git checkout master checking out files: 100% (2409/2409), done. switched branch 'master' me@server:~/rootdir$ git force -u tmp_branch master fatal: 'tmp_branch' not appear git repository fatal: remote end hung unexpectedly me@server:~/rootdir$ git force -u his_repo master username 'https://github.com': me@gmail.com password 'https://me@gmail.com@github.com': https://github.com/him/his_repo.git ! [rejected] master -> master (non-fast-forward) error: failed force refs 'https://github.com/him/his_repo.git' hint: updates rejected because tip of current branch behind hint: remote counterpart. merge remote changes (e.g. 'git pull') hint: before pushing again. hint: see 'note fast-forwards' in 'git force --help' details.

thanks much :)

to create advisor’s repository contain files, , forget repository:

add repository remote check out new local branch tracks master branch make new commit on branch replaces files yours push branch remote remove old remote local repository (and delete on remote server if want)

in log of shell commands, got steps 1 , 4 working. step 4 failed because didn’t steps 2 , 3. when tried force commit history remote in step 4, on branch of old repository, had different history. git refused because overwriting of history history. prepare that, start history checking out branch, , add together new commit history replaces files yours.

i haven’t memorized exact git commands of above – utilize gui – here know each step:

git remote add together his_repo https://github.com/him/his_repo.git git branch branch_for_his_work his_repo/master, followed git checkout --merge branch_for_his_work. switch branch tracks repo, , --merge means instead of overwriting files working re-create files, git start three-way merge. to overwrite files yours, resolve merge files staged, , none of his. git commit …. git force … git remote remove origin, , git remote rename his_repo origin if want phone call remote “origin” instead of “his_repo”. git branch -m branch_for_his_work master “master” branch, , refers advisor’s history.

steps 2 , 3 bit harder need because don’t know of flag git checkout means “leave working re-create – alter git’s head”. if there such flag, git add together -a , git commit in step 3, without having deal merge conflicts. or re-create files out before steps 2 , set them before step 3, uses more disk space, simpler, much manual solution said used.

git github

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -