Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Git for developers: Difference between revisions

From MoodleDocs
No edit summary
m (Protected "Git for developers": Developer Docs Migration ([Edit=Allow only administrators] (indefinite)))
 
(183 intermediate revisions by 38 users not shown)
Line 1: Line 1:
This document are for purpose to make you start super quickly (in the hour) with GIT. It doesn't have for purpose to explain you GIT. Please have a look to the real
{{Template:Migrated|newDocId=/docs/guides/git/}}
 
1. Go on [https://github.com/ Github] and create a account.
 
2. Go on https://github.com/moodle/moodle and click on Fork button. You now have your github repository.
 
3. Install GIT on your computer. If you are on Mac, [http://code.google.com/p/git-osx-installer/ git-osx-installer] install it in few click.
 
4. Now the technical part, you will need to setup your SSH public key, so you can push to your github repository from your local repository. On mac you get go on this [http://help.github.com/mac-key-setup/ Github help page]. If you are on another system, in the Github administration, section SSH Public Keys, you should see a link to a help page. Is it done? Good, it was some difficult.
 
5. Create a clone from your github repository
<code bash>
git clone git@github.com:YOUR_GITHUB_USERNAME/moodle.git ./YOUR_LOCAL_MOODLE_FOLDER/
</code>
 
6. Now you are going to create update script in order to update your cvshead. For that first we need to edit the file .git/config that is in YOUR_LOCAL_MOODLE_FOLDER. Create something like this:
 
<code bash>
 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@github.com:YOUR_GITHUB_USERNAME/moodle.git
[branch "cvshead"]
        remote = upstream
        merge = refs/heads/cvshead
[remote "upstream"]
    url = git://git.moodle.org/moodle.git
    fetch = +refs/heads/*:refs/remotes/upstream/*
 
</code>
 
7. Create a update script (example: ./update_github)
 
<code bash>
cd YOUR_LOCAL_MOODLE_FOLDER
git fetch upstream
git checkout cvshead
git pull
git push origin refs/remotes/upstream/cvshead:cvshead
</code>
 
8. Run the./update_github script. Your local repository ("cvshead" branch) and your github repository ("cvshead" branch) will be updated from git.moodle.org.
 
9. Now when you want to work on a new issue:
* run the update script (take care to have stach/committed the change of current branch)
* create a new branch
* fix the bug
* commit, push and do a pull request.

Latest revision as of 12:14, 14 April 2023

Important:

This content of this page has been updated and migrated to the new Moodle Developer Resources. The information contained on the page should no longer be seen up-to-date.

Why not view this page on the new site and help us to migrate more content to the new site!