Here is the Jaime Barriga foolproof way for not screwing anything up when you want to push and pull from a github repository.

You may be here because you want to learn the ways of the master. You may be here because you royally messed something up.

I am here because I am a genius that's been working with git for years, and I programmed for a company that had thousands of engineers working on one repo and I didn't screw anything up.

I deserve a medal for this guide.

The steps for how to not ruin your pushes and pulls in git:

0. git status

1. git branch

2. git pull

3. git checkout -b whatever_you_want_to_call_this_new_branch_where_you_will_work_on_stuff

5. git do all the work for me

Once the work is done:

6. git merge origin/master

7. git add --all

8. git commit -am "This is the commit message that I saw on as a good commit message to use"

9. git diff origin/master

10a. git push

10b. Go to the website that it tells you to go to.

10c. When your pull request gets approved

11. git checkout master

12. How many of you noticed step 4 was missing?

You are done.

All of this might be overkill, but I've been using this process for years, and I can now safely say that the only issues I've had are because I didn't follow my own advice and I screwed something up.

Addendum 1: What about git rebase?

This is how you thank me?

Addendum 2: Help I screwed something up!

We're going to solve this the way I solve all my problems: with the surgical precision of a suicide vest.

1. Find all the files you were working on and save them somewhere else on your computer

2. Nuke the folder (on your computer, not on github) containing the entire repo you are working on.

3. Put the repo back on your computer with `git clone whatever_the_github_website_tells_you_the_git_clone_line_is_on_the_github_website`

4. Put the files you saved back where they came from

Go to my articles about pizza or game design.