パッチの作成#
scikit-image にバグや変更したい点を見つけましたか? — 素晴らしい!
修正方法を考えましたか? — さらに素晴らしい!
それを私たちに教えてください — 最高です!
最も簡単な方法は、パッチまたはパッチのセットを作成することです。ここではその方法を説明します。パッチの作成は最も簡単で迅速ですが、簡単な修正以上のことを行う場合は、代わりに開発のためのGitモデルに従うことを検討してください。
パッチの作成#
概要#
# tell git who you are
git config --global user.email you@yourdomain.example.com
git config --global user.name "Your Name Comes Here"
# get the repository if you don't have it
git clone https://github.com/scikit-image/scikit-image.git
# make a branch for your patching
cd scikit-image
git branch the-fix-im-thinking-of
git checkout the-fix-im-thinking-of
# hack, hack, hack
# Tell git about any new files you've made
git add somewhere/tests/test_my_bug.py
# commit work in progress as you go
git commit -am 'BF - added tests for Funny bug'
# hack hack, hack
git commit -am 'BF - added fix for Funny bug'
# make the patch files
git format-patch -M -C main
次に、生成されたパッチファイルをscikit-image開発者フォーラムに送信してください。 — 温かく感謝いたします。
詳細#
コミットにラベルを付けることができるように、git に自分の身元を伝えます
git config --global user.email you@yourdomain.example.com git config --global user.name "Your Name Comes Here"
まだ持っていない場合は、scikit-image リポジトリのコピーをクローンします
git clone https://github.com/scikit-image/scikit-image.git cd scikit-image
「フィーチャブランチ」を作成します。これはバグ修正を行う場所になります。安全で、メインブランチの変更されていないコードにアクセスできます
git branch the-fix-im-thinking-of git checkout the-fix-im-thinking-of
編集を行い、コミットします
# hack, hack, hack # Tell git about any new files you've made git add somewhere/tests/test_my_bug.py # commit work in progress as you go git commit -am 'BF - added tests for Funny bug' # hack hack, hack git commit -am 'BF - added fix for Funny bug'
commit
の-am
オプションに注意してください。m
フラグは、コマンドラインにメッセージを入力することを示します。a
フラグ — 信頼してください — または なぜ -a フラグを使うのですか? を参照してください。完了したら、すべての変更がコミットされていることを確認します
git status
最後に、コミットをパッチにします。
main
ブランチから分岐してからのすべてのコミットが必要ですgit format-patch -M -C main
コミットの名前が付いた複数のファイルが作成されます
0001-BF-added-tests-for-Funny-bug.patch 0002-BF-added-fix-for-Funny-bug.patch
これらのファイルを scikit-image開発者フォーラム に送信してください。
完了したら、コードのメインコピーに戻るには、main
ブランチに戻ります
git checkout main
パッチ適用から開発への移行#
パッチを作成し、1つ以上のフィーチャブランチがある場合は、開発モードに切り替えることをお勧めします。これは、既存のリポジトリで行うことができます。
github で scikit-image リポジトリをフォークします — scikit-image の独自のコピー (フォーク) を作成する。次に
# checkout and refresh main branch from main repo
git checkout main
git pull origin main
# rename pointer to main repository to 'upstream'
git remote rename origin upstream
# point your repo to default read / write to your fork on github
git remote add origin git@github.com:your-user-name/scikit-image.git
# push up any branches you've made and want to keep
git push origin the-fix-im-thinking-of
その後、必要に応じて、開発ワークフローに従うことができます。