svn
とcvs
の年を経て、git
をピックアップしています。私はそれの大部分のハングアップを持っているが、私は一般的な使用順序が最適であるとは思わない。遠隔の 'origin'リポジトリを使ったgitの使用
マイセットアップ: 私は私のプロジェクトで、「マスター」リポジトリのように扱われているorigin
サーバーからローカル、クローン化されたリポジトリと私のワークステーション上で開発を行います。私はgit fetch
を定期的に実行し、新しい更新を確認してから、git merge
をマージして関連性があればそれをマージします。
しかし、私が作業しているときに疑問があるコードの枝をチェックしているときです。
私が使用する共通の配列:
git push origin master:blahblah # This won't let me push to master branch
ssh origin
cd repodir
git merge blahblah
git branch -d blahblah
logout
git status # this shows me I'm still ahead
git pull origin # to bring them back in sync
git remote show origin # shows I have a stale blahblah branch
git remote prune origin # cleans that up
そして今、私は彼らが同期持っている:
git branch somenewbranch
git checkout somenewbranch
... work work work ...
git add [changed files]
git commit
git checkout master
git merge somenewbranch
git branch -d somenewbranch
ここでは、私が最適化される可能性が考えるものです。これは私のローカルと "マスター"リポジトリを同期させるための余分な手順のようです。
私の使用方法を最適化するのに役立つ人はいますか?
ありがとうございます。
EDIT:私は別の支店をしない場合は、私が述べてエラーが表示されます。
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
私はエラーメッセージと共に投稿を編集しました。私はあなたが説明したことが私の混乱につながったと思います。問題は、起点サーバーにも時々devを実行することですが、今はすべてを裸のレポに入れ、ローカルサーバーと元のサーバー上の作業ディレクトリの両方にクローンする必要があると思います。 –
これを行う必要がある場合は、素早く 'git clone repodir working'を実行し、終了したら' git push && cd .. && rm -rf working'を実行してください。 – coreyward
ええ、私は裸のレポクローンを作成しました、そして、それはそれを分類しました。愚かなnewbの間違い。ご協力ありがとうございました;今すぐ使用する方が簡単です:-) –