2017-02-14 9 views
1

GitHubのbiopython/biopythonリポジトリをBioGeek/biopythonにフォークしました。フォークされたGitHubリポジトリを同期しようとした後にローカルファイルが復帰しました

自分のローカルリポジトリでcommittedを変更し、pull requestを作成し、上流のbiopythonリポジトリにmergedを作成しました。ここまでは順調ですね。

私はfurther commitsを私のリポジトリに作成し、そのあとにはother commitsをメインのbiopythonリポジトリに作成します。

今、私がメインリポジトリから変更を引っ張って私のローカルリポジトリを更新したいので、私は:

$ git pull upstream master 
remote: Counting objects: 12, done. 
remote: Compressing objects: 100% (5/5), done. 
remote: Total 12 (delta 9), reused 10 (delta 7), pack-reused 0 
Unpacking objects: 100% (12/12), done. 
From https://github.com/biopython/biopython 
* branch    master  -> FETCH_HEAD 
    06b6cd64d..6e41879ca master  -> upstream/master 
First, rewinding head to replay your work on top of it... 
Applying: add header back to 1LCD.pdb file 
Applying: actually check that the warning was raised instead of surpressing it 
$ git status 
On branch master 
Your branch and 'origin/master' have diverged, 
and have 100 and 3 different commits each, respectively. 
    (use "git pull" to merge the remote branch into yours) 
Untracked files: 
    (use "git add <file>..." to include in what will be committed) 

    ../Doc/examples/tree1.nwk 

nothing added to commit but untracked files present (use "git add" to track) 

次私は私のフォークリポジトリ内のmasterブランチを更新したいので、私は実行します。

$ git push origin master 
To https://github.com/BioGeek/biopython.git 
! [rejected]   master -> master (non-fast-forward) 
error: failed to push some refs to 'https://github.com/BioGeek/biopython.git' 
hint: Updates were rejected because the tip of your current branch is behind 
hint: its remote counterpart. Integrate the remote changes (e.g. 
hint: 'git pull ...') before pushing again. 
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

hmm、rejected。だから私は、GitHubのヘルプからページSyncing a forkをプルアップし、そこからの指示に従ってください:

$ git fetch upstream 
$ git checkout master 
Already on 'master' 
Your branch and 'origin/master' have diverged, 
and have 100 and 3 different commits each, respectively. 
    (use "git pull" to merge the remote branch into yours) 

うーん、私はgit pullを使用する必要がありますので、私は

$ git pull 
First, rewinding head to replay your work on top of it... 
Applying: MAF parser, intitial checkin. Passes unit tests 
[... some 100 lines omitted ...] 
Applying: Update test to match changed exception 
Applying: Thank Jeroen for test_QCPSuperimposer.py update 
Applying: Fix unit test, failed under PyPy 5.6.0 

しかし、今、私が行った変更であることをやりますローカルにファイル1LCD.pdbtest_SeqIO_PdbIO.pyが消えました!私はそれらをコミットしたので、どのように私はそれらを戻すと、私は私のフォークを同期したいときに私はこの混乱をもう一度やり直していないように間違っていた。

答えて

1

あなたは初めての最新のbiopythonマスターに基づいていませんでした。コミット後には、まだフォークレポでプルしていない複数のコミットがあるので、PRでもbiopythonマスターにマージされますが、フォークレポは異なります。

enter image description here

だから、マスターで作品をマージし、削除し、その後、その後、ローカルのmasterブランチを削除し、あなたのローカルマスターブランチとしてメインbiopythonマスターを扱う、あなたが別のブランチにプッシュされていない作業を保存することができます一時的な支店、以下のような詳細手順:

git checkout -b temp 
git branch -D master 
git checkout upstream/master 
git checkout -b master 
git merge temp 
git branch -D temp 
関連する問題