If you would like to walk through the git contribution process to submit changes, skip this section and move down to the [cheatsheat](#"Gitea cheat sheet for beginners and the forgetful"). But if you have no interest in expending that much energy, you can skip git entirely and submit a detailed suggestion to our [kanban board (link)](https://kanban.lollipopcloud.solutions/).
# Gitea cheat sheet for beginners and the forgetful
Below is the basic Gitea workflow, to help you with your contributions. But do not hesitate to reach out to any of the organizers for help! We're happy to walk you through any or all of this, no matter what your experience level. If you've never even heard of Gitea before, we'd love to help you submit your first contribution!
This document gets wordy because Git is not as welcoming to beginners as we wish it was, but you can do it! And you're not alone! We are just a message or comment away. There are even more resources in the [Bibliography](#Bibliography) at the end, if you want to dive deeper. You may even want to skip this document entirely at first, and see if [Your First Pull Request (link)](https://joshuahunter.com/posts/your-first-pull-request/) more suited to your needs.
A fork is an exact copy of the project as it existed at the exact moment you forked it. So when the project updates in the future, you will have to update your code too, but we will talk about that later.
At this point, you will need a command line client like [PuTTY (link)](https://putty.org/) for Windows users, or the built-in Terminal for MacOS users.
Git will install the project in a new folder. Use the command `ls` to see the name of the new project folder if you are unsure. Open this new folder with
`cd cloned_directory_name` to see what was installed.
### Add the upstream path (Do this step only once!)
If the master (where you forked FROM) changes, you will have to update your local clone. You will only have to do this step ONE time!
From your `cloned_directory_name` directory, do this:
`git remote add upstream https://git.lollipopcloud.soltuions/lollipop_cloud/original_repository.git` (with the original repository URL).
### Create a branch
The `git checkout` command at the end will create a branch, but this is a good practice for each time you want to create a new branch for contributing:
`git checkout master`
`git fetch upstream`
`git rebase upstream/master`
`git checkout -b new_branch_name`
Now the changes you make will be associated with `new_branch_name`.
### Edit your contributions
Now that the files live locally on your computer, and you have a branch set up for your new contributions, you can edit the files with your favorite editor. Stick with the command line (Vim, Emacs, Nano), or use a text editor like [Atom (link)](https://atom.io/). Be sure to save your changes.
When you're really ready, "push" those changes to the original source, which is a request to accept and merge your contributions with the rest of the project. **Note:** A push request and a merge request are the same thing.
Go back to your browser and your forked repository `https://git.lollipopcloud.solutions/your-username/forked-repository` and go to Pull Requests and choose `New Pull Request`.
There will be two drop-down menus that will probably say `base: master` and `compare: master`. The "base" fork is the original project, NOT your forked version. Under the `compare` menu, choose your `new_branch_name`. Enter a short title for the changes, a description to help reviewers understand your contributions, and click the big `Submit Pull Request` button below your text.
## Congratulations! You've submitted your first pull request! 🎉
The developers will review your changes and work with you on next steps.
# Troubleshooting
## What to do when "upstream" changes...
"Upstream" is the name of the original code (not your fork). When it gets updated after you clone or fork, you will have to request a copy of those changes to stay up-to-date.
### Fetch the changes since you first forked or last fetched changes
In order to be sure you're working off the latest copy of the project, you can fetch the latest changes with `git fetch upstream`. (Note: this can only be done at the command line, not the user interface/URL.)
Now you have the latest copy of the project in your local directory. Your new changes from this point forward will be stored in a local branch called `upstream/master`.
Make your edits! Then you can go back to the section [about adding your changed files to git](#Add your changed files to git, to prepare them for uploading).
* [Git Book (link)](https://git-scm.com/book/en/v2)
* [Git Cheat Sheet (link)](https://github.com/mikeizbicki/ucr-cs100/blob/2015winter/textbook/cheatsheets/git-cheatsheet.md): May be helpful for setting up Git from scratch.