GitHub is a web-based version control and collaboration platform used by over 31 million users. It allows users to store code in online repositories and collaborate on projects. The document provides instructions on setting up a GitHub account, installing Git, creating and committing to repositories, opening pull requests to contribute to others' projects, forking repositories to contribute back to open source projects, and cloning repositories to work on code locally.
2. Let me ask you some questions first
- Do you have any kind of coding project?
(It might be simple Java / C++ / Python etc…)
- Now, if someone asks you to share your code,
how will you do it?
3. Here’s your solution:
GitHub lets you upload all your project
files in one particular place for sharing
and collaboration
4. What is GitHub?
- Founded in 2008
- Web based version control and source
control management using git
- 31m users; 100m repositories
- Acquired by Microsoft on June 2018
for $7.5b
7. GitHub dictionary – Bare minimum
- “repository” – a.k.a repos are big chunks of
code that can be edited by GitHub members
- “forked” – the term for code editing/changes
- “pull request” – intimation sent to the original
code writer requesting edit rights
More here: https://help.github.com/articles/github-glossary/
8. More here: https://github.com
Set up a GitHub account
- Signup to create a username
and password and associate
them with your email
- Free account gives you the
opportunity to work on other
people’s projects and create
your own public repos.
- To create your own private
repos, you need to upgrade to a
paid subscription (unless a verified
student, teacher or academic researcher)
15. Create a new branch
- A branch is a snapshot of the
base branch (master in this
example) at a moment in time
- You can make changes to the
new branch without affecting
the base branch, until you
merge the branches
16. Create a README
- Created with Markdown
language (.md files)
- GitHub version called GitHub
Flavored Markdown
- Preview changes to see what
it looks like before committing
17. Commit changes to your GitHub repository
- You can commit your changes
from either panes
- Give a good description of
what you’ve done
- Go back to the top-level
repository to see your commit
shown.
18. Commit changes to your GitHub repository
- Switch back and forth
between the master
branch and your new
branch to see
README changes
and compare them
visually.
- Click on the commit
comment to open a
side-by-side source
code view
19. Open a pull request for your GitHub repo
- Submitting a PR is the way
you can contribute to
open source projects that
have a small number of
committers.
- When you make the
changes locally first,
committing to your local
repo and pushing to the
upstream repo (e.g. on
GitHub) are separate
steps.
20. Merge a pull request into your master
- On main repo page, click
the green “Compare &
pull request” button.
This time the exact pull
request you want to
submit will come up.
- When told that the
request has no conflicts,
press the green “Merge
pull request” button
21. Delete the merged branch
- Feel free to delete the
successfully merged
branch, using the button
to the right of the purple
icon.
- Consider adding a branch
every time you start
working on a feature, and
deleting the working
branch once it has been
successfully merged into a
production branch.
22. Clone a GitHub repo
- In real life people mostly
write code & docs on their
own machines, not online.
- Go to the code pane of the
repo and click on the green
“Clone or download” button.
- We don’t want to download
a Zip; instead, we want to
clone the repo with Git or
GitHub Desktop.
23. - If you installed GitHub Desktop, click on “Open in Desktop.”
- Your GitHub Desktop would look something like the image below once
the clone finished:
- Click on the copy icon to the right of the URL for your repo and paste
the URL into a console after the command git clone
24. Fork a GitHub repo
- Search for popular repos from GitHub to contribute back.
- Fork is the way to contribute to someone else’s open source project.
- Once you’ve got a forked repo, not only can you treat it as your own, but
you can also apply later commits from the upstream repo from which you
created the fork, and submit pull requests back to the upstream repo.