Movatterモバイル変換


[0]ホーム

URL:


SciPy

Getting started with Git development

This section and the next describe in detail how to set up git for workingwith the NumPy source code. If you have git already set up, skip toDevelopment workflow.

Basic Git setup

  • Install git.

  • Introduce yourself to Git:

    gitconfig--globaluser.emailyou@yourdomain.example.comgitconfig--globaluser.name"Your Name Comes Here"

Making your own copy (fork) of NumPy

You need to do this only once. The instructions here are very similarto the instructions athttp://help.github.com/forking/ - please see thatpage for more detail. We’re repeating some of it here just to give thespecifics for theNumPy project, and to suggest some default names.

Set up and configure agithub account

If you don’t have agithub account, go to thegithub page, and make one.

You then need to configure your account to allow write access - see theGeneratingSSHkeys help ongithub help.

Create your own forked copy ofNumPy

  1. Log into yourgithub account.

  2. Go to theNumPy github home atNumPy github.

  3. Click on thefork button:

    ../../_images/forking_button.png

    After a short pause, you should find yourself at the home page foryour own forked copy ofNumPy.

Set up your fork

First you follow the instructions forMaking your own copy (fork) of NumPy.

Overview

gitclonehttps://github.com/your-user-name/numpy.gitcdnumpygitremoteaddupstreamhttps://github.com/numpy/numpy.git

In detail

Clone your fork

  1. Clone your fork to the local computer withgitclonehttps://github.com/your-user-name/numpy.git

  2. Investigate. Change directory to your new repo:cdnumpy. Thengitbranch-a to show you all branches. You’ll get somethinglike:

    *masterremotes/origin/master

    This tells you that you are currently on themaster branch, andthat you also have aremote connection toorigin/master.What remote repository isremote/origin? Trygitremote-v tosee the URLs for the remote. They will point to yourgithub fork.

    Now you want to connect to the upstreamNumPy github repository, soyou can merge in changes from trunk.

Linking your repository to the upstream repo

cdnumpygitremoteaddupstreamhttps://github.com/numpy/numpy.git

upstream here is just the arbitrary name we’re using to refer to themainNumPy repository atNumPy github.

Just for your own satisfaction, show yourself that you now have a new‘remote’, withgitremote-vshow, giving you something like:

upstreamhttps://github.com/numpy/numpy.git(fetch)upstreamhttps://github.com/numpy/numpy.git(push)originhttps://github.com/your-user-name/numpy.git(fetch)originhttps://github.com/your-user-name/numpy.git(push)

To keep in sync with changes in NumPy, you want to set up your repositoryso it pulls fromupstream by default. This can be done with:

gitconfigbranch.master.remoteupstreamgitconfigbranch.master.mergerefs/heads/master

You may also want to have easy access to all pull requests sent to theNumPy repository:

gitconfig--addremote.upstream.fetch'+refs/pull/*/head:refs/remotes/upstream/pr/*'

Your config file should now look something like (from$cat.git/config):

[core]repositoryformatversion=0filemode=truebare=falselogallrefupdates=trueignorecase=trueprecomposeunicode=false[remote"origin"]url=https://github.com/your-user-name/numpy.gitfetch=+refs/heads/*:refs/remotes/origin/*[remote"upstream"]url=https://github.com/numpy/numpy.gitfetch=+refs/heads/*:refs/remotes/upstream/*fetch=+refs/pull/*/head:refs/remotes/upstream/pr/*[branch"master"]remote=upstreammerge=refs/heads/master

Table Of Contents

Previous topic

Git for development

Next topic

Git configuration

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp