Skip to content
Jannik Steinmann edited this page Nov 8, 2017 · 1 revision

Intro to Github

In general, there are a few simple steps to follow if anyone wants to make changes to the repository:

  1. Fork this repository

    • Click "Fork" in the top right corner of this page
    • This creates a copy of the repo under your own account
  2. Clone your fork to your local computer

    • Click the green button "Clone or download" just above the file listings on the of your fork
    • Copy the URL to your clipboard
    • Type git clone <paste the URL here> wherever you want it in your file system (This creates a new folder and downloads all the files)
  3. Set the upstream repo

    • This step is needed to keep your fork up to date later on
    • Type git remote add upstream https://github.com/codeforosnabrueck/wahlversprechen.git into your terminal
    • Type git fetch upstream into your terminal. This will download all the original files from this repository as well so you can merge them later locally (Step 7).
  4. Change the the branch

    • Change to whatever branch most suits to what you are planning to do
    • Type git checkout <branch name> (If there are no branches besides the master yet, you can skip this step)
  5. Do all the changes you want!

  6. Test whether everything works fine!

  7. Add your files to the index

    • Type git status to check all the files that have been edited
    • Type git add <file name> for all files that you want to add or simply git add -A to add them all
  8. Commit your work

    • Type git commit -m "Useful description" to save a "screenshot" of your process
    • This step should be done for all simple but complete changes to your files because commits can later be reverted
  9. Pull the the remote repo

    • Before you push your files to this remote repo, you need to check for the latest updates of it
    • To download all the latest changes, type git pull upstream <branch name> into your terminal and download all files
  10. Fix merge conflicts

    • If there are any, fix them.
    • You can use git diff <file name> to see changes between your local and the remote file
  11. Push your files

    • To upload your local repo, type git push origin <branch name>
    • If all merge conflicts were fixed in the previous step, your files should now be uploaded to your remote fork
  12. Start pull request 🎉

  • Go back to your fork in the browser and hit "New pull request" on left right next to the "branches"-pulldown
  • Click "create pull request" and enter all the specifics of what you have done
  • Here you can also link to issues
  • Click "Create pull request"

This cheat sheet should also give a good overview of the commands of git:

Cheat Sheet

Clone this wiki locally