Git is the platform in which developers can work together on a project.
- If you dont already have a running git repository, run
git init
in the folder in which you want to create your git repository - Make sure to set up your git username and email before making any changes:
- Run
git config --global user.name "YOUR NAME"
to set the author's name - Run
git config --global user.email "YOUR_EMAIL@example.com"
to set the authour's email
- To install the hook on your local machine, run
scp -p -P 29418 <GERRITUSERNAME>@gerrit.wikimedia.org:hooks/commit-msg .git/hooks/
- To check which remote you currently have, run
git remote -v
- If you need to add a new remote to push to run
git remote add NAME LINK_TO_REPO
Make sure you do this before making any changes as to aviod future complications.
- Find the project you are working with on here. This should contain the most updated version of your project. (Ex: MathSearch Extension)
- Using the repository url, from your project, make a new remote called 'upstream' by running
git remote add upstream REPOSITORY_URL
(MathSearch repository url: https://git.wikimedia.org/git/mediawiki/extensions/MathSearch.git) - You also have to make a gerrit remote. First find your project on here. Then log in and click ssh in the top left. This should give you a ssh link which you will use next. Run
git remote add gerrit SSH_LINK
(Ex: (MathSearch Link) ssh://GERRITUSERNAME@gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch) - Run
git fetch upstream
to get the temporarily get access to the most updated version on the project you are working on - Run
git diff master..upstream/master
to check the differences between your local repository and the most updated version. If nothing appears, then you have the most updated version on your local machine. Otherwise, continue to step 5 - There are many ways to approach this problem but the method being shown here will download a new fully updated branch and we will make it your new master branch. (NOTE: THIS WILL REMOVE ALL THE CHANGES THAT YOU HAVEN'T COMMITTED)
- Run
git pull
- Redo steps 4 and 5 to see if you have any differences in your code and the most updated code
Gerrit is a cooperative platform which allows other users to review your code. You have locally stored commits, files you want to be reviewed, which can be pushed for review on Gerrit.
######Before you make any changes you should check to see if you have the most updated version of whatever you will be commiting to visit Keeping your local repository updated
- Save the id_rsa.pub (Public) content under your account WikiMedia-->Settings-->SSH Public Keys
- You might have to add a remote which uses ssh rather than anonymous https (for example
ssh://USERNAME@gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch
rather thanhttps://gerrit.wikimedia.org/r/mediawiki/extensions/MathSearch
) - cd into folder of commitment (~/MathSearch)
- Run
git status
to check modified files - Run
git add FILENAME
orgit add -A
if you want to commit everything fromgit status
- Run
git commit
to update the local commit files - Add project description/title to file
- Run
git review
to push for review on gerrit OR (if "git review" doesn't work) rungit push [remote name] HEAD:refs/for/master
to push your commits anywhere else
- Log on to gerrit
- In the upper left hand corner go to My-->Changes
Multiple commits can be squashed into a single upload on a branch with multiple patches.
- cd into folder of commitment (~/MathSearch)
git rebase -i HEAD~1
- Replace "pick" in commit message with "squash"
git review
to push for review on gerrit
GitHub allows files and contributions to be collected and stored in a Cloud collective project database.
- Log onto your GitHub account
- Request to be added to the DRMF directory
- Navigate to the branch to which you want to contribute
- Click the [+] next to the directory address to add a new pull request
- Copy/paste the file and add appropriate name and description
- Choose the option to "commit directly to the master branch"
- Commit changes