GitHub Workflow - spicy-memes17/enterprise-memes GitHub Wiki

Github Workflow for spicy-memes

Creating a new feature branch

  1. Make sure you have the newest version of the origin/master branch: git checkout master & git pull
  • Create a new branch called new-feature to work in
    • git branch new-feature-#issue to create the new branch, where issue is the number of the issue on github you are working on, e.g. #19. The name of the branch should not be new-feature but something a little more descriptive...
    • git checkout new-feature-#issue to switch to the new branch
    • Hint: you can always use git branch to see what branch you are currently developing on
  • Commit your code
    • You can see all changes you have made using git status
    • To add files to your commits use git add [filename]. To add all files use git add .
    • Commit your changes using git commit -m "[your message] -m "[your submessage]".
    • Example: git commit -m "update meme generator to make more spicy memes" -m "the generator now uses our self developed AI to be more funny"
  • Push your branch to Github
    • So far the changes you have made are only stored locally.
    • To push your new feature to Github use git push origin new-feature-#issue
    • Please please please don't commit to master.
    • Your code doesn't need to be finished. You can also push if you want input from someone else or if someone else will also work on this feature.
    • If the branch you are pushing from is not in sync with the branch on Github (because someone else has worked on it) you have to pull the changes before pushing yourself: git pull origin new-feature-#issue
  • Open a Pull Request
    • When your work is done open a Pull Request from your branch to master.
    • Open your branch on Github.com and click "New pull request", then "Create pull request"
    • Now everyone can look at your code. The Infrastructure Managers will then merge your code into master.

Working on remote branches

To switch to a remote branch that someone else has already pushed to Github use git branch -r to see a list of remote branches. Then you can use git checkout [branchname] as above.

Using a GUI

I don't know... I hope the keywords are the same so just look out for them?

Helpful Guides

Understanding the GitHub Flow

Git basics - a general workflow