|
| 1 | +Workflow |
| 2 | +======== |
| 3 | + |
| 4 | +Recommended one-time setup |
| 5 | +-------------------------- |
| 6 | + |
| 7 | +Remove ``--global`` if you don't want it to apply to other git repos on your computer: :: |
| 8 | + |
| 9 | + git config --global user.name "Your Name" |
| 10 | + git config --global user.email [email protected] |
| 11 | + |
| 12 | +Other git config you might find useful: :: |
| 13 | + |
| 14 | + git config --global push.default simple # makes git only push the current branch, which is useful for not accidentally messing things up |
| 15 | + git config --global color.{ui,status,branch,diff,interactive,grep} auto # makes various interfaces usefully colorful |
| 16 | + git config --global log.decorate true # shows branch information in `git log` by default |
| 17 | + git config --global core.pager "less -R" |
| 18 | + git config --global pager.{status,branch,diff,show,log} true |
| 19 | + git config --global color.pager true |
| 20 | + git config --global core.editor vim # or emacs, nano, your favorite text editor, etc. |
| 21 | + git config --global grep.lineNumber true |
| 22 | + |
| 23 | +For normal, non-urgent features and bug fixes |
| 24 | +--------------------------------------------- |
| 25 | + |
| 26 | +The following workflow applies if you've already been added as a collaborator to the repository. If not, you should fork it using the button on Github, add it as a remote, and replace all of the ``git push``/``git push origin`` steps with ``git push remote-name``. |
| 27 | + |
| 28 | +From the directory ``/esp``: :: |
| 29 | + |
| 30 | + git checkout main |
| 31 | + git pull |
| 32 | + ./update_deps.sh # on vagrant: see vagrant docs; no need to bother if deps haven’t changed |
| 33 | + ./manage.py update # on vagrant: fab manage:cmd=update |
| 34 | + git checkout -b new-branch-name |
| 35 | + |
| 36 | +Write some code! |
| 37 | +Test your code! |
| 38 | + |
| 39 | +Look at what you’ve changed (``git status`` and/or ``git diff``), and then run ``git commit -a``, and type a commit message (see `<http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>` for good commit message style). Repeat a few times from “write some code!” if you want to make multiple commits. |
| 40 | + |
| 41 | +When you’re ready to make a pull request, or want other people to be able to pull your code: :: |
| 42 | + |
| 43 | + git push --set-upstream origin new-branch-name |
| 44 | + |
| 45 | +Now go to `<https://github.com/learning-unlimited/ESP-Website>`_. If you’re logged in, you should see a banner near the top suggesting that you make a pull request. Click the button, write up a summary of your pull request, and submit it. |
| 46 | + |
| 47 | +Now wait for someone to review your pull request. If it takes a long time, poke a friend to review it. |
| 48 | + |
| 49 | +When someone reviews your pull request, they will probably have some comments. If they have a lot to say, or suggest some major changes, don’t feel bad! This is a normal part of the code review process. Now you need to address their comments. If you disagree with what they’ve said, or want to discuss more, feel free to do that on the pull request. To change your code: :: |
| 50 | + |
| 51 | + git checkout new-branch-name # only if you’d switched to another branch while waiting |
| 52 | + Make some changes |
| 53 | + Test your changes |
| 54 | + git commit -a -m "Fixed foo, bar, and baz" |
| 55 | + git push |
| 56 | + |
| 57 | +The reviewer will look at your changes. In some cases, you might go through a few more cycles of this. Once everything is resolved, they’ll merge your pull request. Congratulations! |
| 58 | + |
| 59 | +For urgent features and fixes |
| 60 | +----------------------------- |
| 61 | + |
| 62 | +The following is MIT-specific, although by using a different prod branch a similar thing might work for other sites. :: |
| 63 | + |
| 64 | + git pull |
| 65 | + git checkout $(git merge-base main mit-prod) |
| 66 | + git checkout -b urgent-branch-name |
| 67 | + |
| 68 | +Write some code! |
| 69 | +Test your code! Be careful, since you’re putting this on our live server without full review. :: |
| 70 | + |
| 71 | + git commit -a -m "Did something important" |
| 72 | + git push --set-upstream origin urgent-branch-name |
| 73 | + |
| 74 | + git checkout mit-prod |
| 75 | + git merge urgent-branch-name |
| 76 | + git push |
| 77 | + |
| 78 | +Pull code as described in `<https://esp.mit.edu/wiki/index.php/The_Server#Pulling_New_Code>`_. |
| 79 | + |
| 80 | +Make a pull request for ``urgent-branch-name`` as described above |
0 commit comments