I am an Open Source enthusiast who loves the Internet. I love to create things for the web which are interesting and fun.
Git + Github
- Parbhat Puri
- Abhishek Kumar Tiwari
- What is source code?
- What is open source?
- Who has used git?
- Who has used github?
- Source code is available to play with, modify it and can be distributed generally.
- It can be free or not.
You told me source code is available to play with but where I will get the source code.
Wait a second!
Github is one of the place on Internet where you can get source code of various famous open source projects like Django, vlc, AngularJS.
What is Git?
Git is a version control system(VCS) which is a tool to manage the history of our Source Code.
What is Version control system?
It is having infinite versions of the same file say testing.txt
Time for a Demo
Need 5 volunteers
Can you give us an example?
- It is like the parent of your code. Just like your parents know about the changes in your life. Git knows the changes happened in the life of code. Your life can not be reverted but git can go the past if something wrong happens.
- It takes a snapshot of the code in the history of Project. So if things goes wrong, you can revert back to the most recent working version.
What is Github?
Github is a place to store your git projects online.
It is a social network for
Github allows you to work in a Team
Github allows to
- Get the source code of various open source projects
- Contribute to these projects.
- Make your project open source.
- Work with team to create awesome stuff.
- Manage different versions of your project.
- Create an online resume to showcase the projects you own and contributed to.
- What is Open Source?
Getting your hands dirty..
Setting up Git
- You can download git from http://git-scm.com/downloads
- Tell Git your name
$ git config --global user.name "YOUR NAME"
- Tell Git your E-mail
$ git config --global user.email "YOUR EMAIL ADDRESS"
Don't worry. The above set up is to be done only once.
Sign Up on Github
Create a Repository
- Github Repository is a fancy name for folder on Github
- This folder contains all your project files.
Repository is created
Create a local copy of Github repository
$ git clone https://github.com/Parbhat/sfd-github-workshop.git
It will create a folder in your computer with the same files on github.
- Setting up git on your computer
- What is a Repository?
- How to clone a Github Repository
Start working on your project..
Create a new file in your project like sfd.txt
Great you have created a new file locally. Now its time to send this file on Github so others can see it.
Now Git will come into picture
Git will version control this file named sfd.txt to record the changes happening with file over time.
Run git status inside project folder.
Run git add for tracking new files.
Check the status again.
It is a snapshot of your code.
-m = commit message
Check the status again.
We have created sfd.txt file locally but how to send it to Github
Git push send all commits to github.
Now our github looks like
Great you have made your first Open Source contribution.
- Git status
- Git add
- Git commit
- Git push
Check the status often.
these are the basics
Contributing to projects on Github
Find a project that interests you and fork it
It is creating a copy of project to your account.
This is your copy of the project. Modify it as you like and follow the Git Mantra.
Remember the Git Mantra..
You have made some awesome changes in the project
Open a Pull Request
With Pull request you are asking the maintainer of project to add your changes to the main project.
Give your Pull request a name and description
Maintainer will check the changes and merge it if its correct
Awesome! You are now an Open Source Contributor.
- Fork a project
- Follow Git Mantra
- Open a Pull Request
Git beyond basics
- git rebase
- git merge
- git stash
- git reset
- solve git conflicts
The best way to learn git is to work on projects with a team and witness the awesomeness yourself.
SFD Github Workshop
By Parbhat Puri