GitHub Collaboration Beginners Cheat sheet

If you are a programming newbie you have probably had the overwhelming encounter with the beast that is git. I myself have had to tackle this beast & I have come out on the other side with a few simple steps to help you manoeuvre GitHub collaboration confidently.

Topics: Creating a branch, pushing to a remote repository and making a pull request

You want to collaboratively work on a project and make changes to another developers someones repository:

  1. Ensure the lead developer adds you as a collaborator — Trust me this will make your life much easier

2. Clone the repository you want to change so that you have your own copy of it on your machine — Do Not, I repeat, DO NOT Fork this repository

via git clone <link_from_github>

3. Move into the directory you’ve just cloned via cd <directory_name>

*Note this should be in snake_case

4. Create a new branch, this will identify as the version you are working on via git checkout -b <branch-name>

(return message: Switched to a new branch ‘branch-name’) REMOVE

  • Note: -b is a flag meaning new branch
  • Tip: branch-name should relate to the changes you want to make

5. Now that you are in a new branch you can open and edit the files as you want to make changes to

6. See the files you have made changes to via git status

7. See the changes you have made relative to the original copy via git diff

To add your changes to the project:

8. git add <fileName>.extention || git add . (to add all changes)

9. git commit -m “commit message — state the changes you have made”

10. Push you changes back to the repository you clone via git push origin master

11. On the lead developer’s GitHub account, You should see your <branch-name>, click the green “compare and pull request” button

12. You can now see the changes you have made compared to the current most up-to-date version and resolve conflicts is there are any

13. Click the green “create pull request” button

14. Merge your branch with the current most up-to-date version

Now If you want to make any more changes you follow steps 4–14 and everything will run smoothly.