Git + Github
Speakers
- Parbhat Puri
- Abhishek Kumar Tiwari
Quick Poll
- What is source code?
- What is open source?
- Who has used git?
- Who has used github?
Open Source?
- 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
Can you give us an example?
Yes.
- 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 nerds Developers.
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.
Review
- What is Open Source?
- Git
- Github
Getting your hands dirty..
Setting up Git
$ 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
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.
Review
- Setting up git on your computer
- What is a Repository?
- How to clone a Github Repository
What's next?
Start working on your project..
Create a new file in your project like sfd.txt
Software Freedom Day is everywhere!
SFD is a yearly celebration for Software Freedom!
Every year there are thousands teams organizing
Software Freedom Day in different
countries and cities.
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.
Git status
Run git status inside project folder.
puri@puri-PC:~/sfd-github-workshop$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
sfd.txt
nothing added to commit but untracked files present (use "git add" to track)
Git add
Run git add for tracking new files.
puri@puri-PC:~/sfd-github-workshop$ git add sfd.txt
Git status
Check the status again.
puri@puri-PC:~/sfd-github-workshop$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: sfd.txt
Git commit
It is a snapshot of your code.
puri@puri-PC:~/sfd-github-workshop$ git commit -m "Created sfd text file"
[master 4bd5ead] Created sfd text file
1 file changed, 5 insertions(+)
create mode 100644 sfd.txt
-m = commit message
Git status
Check the status again.
puri@puri-PC:~/sfd-github-workshop$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
SFD Github Workshop
By Abhishek Kumar Tiwari
SFD Github Workshop
Slides for Github workshop in Software Freedom Day 2015.
- 1,270