2017-07-06 8 views
0

私は新しい機能を開発しましたが、マスターブランチにローカルにコミットするのは複雑すぎることに気付きました。次のようにこのように、私は新しいブランチを作成しました:私は新しいブランチをプルしないでどのようにプッシュしますか

$ git stash branch project_0.2 [email protected]{0} 

もちろんの問題は、私は私が手にサーバーに新しいブランチをプッシュしようとすることです:

$ git push origin master 
To https://svn.tudelft.nl/git/project.git 
! [rejected]  master -> master (non-fast-forward) 
error: failed to push some refs to 'https://svn.tudelft.nl/git/project.git' 
hint: Updates were rejected because a pushed branch tip is behind its remote 
hint: counterpart. Check out this branch and integrate the remote changes 
hint: (e.g. 'git pull ...') before pushing again. 
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

私が見てきましたインターネットとどこでも私はgit pullと変更をマージする必要があります参照してください。 (私はバックアップを作成する前に)私はこれを試みたが、私が取得:

$ git pull 
remote: Counting objects: 1105, done. 
remote: Compressing objects: 100% (304/304), done. 
remote: Total 725 (delta 501), reused 552 (delta 382) 
Receiving objects: 100% (725/725), 5.29 MiB | 0 bytes/s, done. 
Resolving deltas: 100% (501/501), completed with 165 local objects. 
From https://svn.3me.tudelft.nl/git/project 
    5d6516c..fd424b5 master  -> origin/master 
There is no tracking information for the current branch. 
Please specify which branch you want to merge with. 
See git-pull(1) for details. 

    git pull <remote> <branch> 

If you wish to set tracking information for this branch you can do so with: 

    git branch --set-upstream-to=origin/<branch> project_0.2 

私は停止して、私はここで何をすべきかわかりません。また、変更はとても深く、私は永遠に合併するだろう。ブランチをサーバーにプッシュするよりスマートな方法があると私は考えました。このようにして、コードを修正する際に私のチームの他のメンバーから助けを得ることができます。これは可能ですか?

+0

「gitのプッシュ原点」を配置する必要がプッシュするためにあなたがして、あなたのブランチを作成しました最も奇妙な方法。いずれにしても、典型的なワークフローは新しいブランチをプッシュし、プルリクエストを作成して「マスター」に戻すことです。答えを与えるリスクが多すぎる。 –

+0

@TimBiegeleisen [この回答](https://stackoverflow.com/a/30927991/611873)を読んだ後、良い解決策に思えました。 – aaragon

+0

あなたがこのブランチで何をしたいかを教えてもらえれば、多分答えまたは示唆を与えることができます。 –

答えて

0

それは今、この新しいブランチをプッシュし、ローカルマシンに新しいブランチを作成します

git checkout -b NewBranchName 

を使用して最初の新しいブランチを作成します。

git push origin NewBranchName 
0

マスターブランチで行っていたことから新機能を分離したい場合は、@UniCoderの言うことを実行する必要があります。で新しいブランチを作成します。

git branch NewBranchName 

はでそれをアクティブ化します。

git checkout -b NewBranchName 

は、あなたの開発を行い、必要なオブジェクトを追加し、あなたがこの機能に行った作業をコミットしてから、新しいブランチを作成:

git push origin --set-upstream NewBranchName 

後であなただけ

+0

はい、私はこれを見ていますが、遅すぎると私は新しい支店が必要だと気付きました。 – aaragon

+0

あまりにも悪いですが、私はあなたが多くの再作業する必要はなかったことを願っています。 –

関連する問題