Intro to

- Sumith1896

What git?

  • What is git?
  • What is version controlling?
  • Why version controlling?

What is git?

Git  is a distributed revision control software. Git was initially designed and developed by Linus Torvalds for Linux

What is version controlling?

Having infinite version of the same  file.

#CS101_nostalgia

Basically...

...the purpose Git was designed to serve. When you have a Microsoft Word file, you either overwrite every saved file with a new save, or you save multiple versions. With Git, you don’t have to. It keeps “snapshots” of every point in time in the project’s history, so you can never lose or overwrite it.

In case things go wrong, revert back to the most recent working version

Why version controlling?

  • File names and directory structures that are consistent for all team members.
  • Making changes with confidence, and even reverting when needed.
  • Easily deploying different versions of your code to staging or production servers.
  • Understanding who made a change and when it happened.

Why git?

  • Revert back to the most recent working one.
  • Try out new experimental features.
  • Collaborating with other people.
  • Statistics of contribution.
  • Easily find the people responsible for certain part of code :P.
  • Productivity.
  • Sanity!!

Why use git in ITSP?

  • It is very easy for mentors to review your code.
  • Some teams are going back home, git/GitHub is the best way to collaborate.
  • Learn a new thing : main motive of ITSP
  • Feel aati hai!! :P

How git?

  • Setting up git
  • Terminologies
  • Basic git commands

Setting up git

1. Installation

$ sudo apt-get install git

2. Personalization

$ git config --global user.name "Lorem Ipsum"
$ git config --global user.email loremipsum@foo.com

3. Initialization of a project

$ mkdir itsp-project
$ cd itsp-project
$ git init

Terminologies

Repository: A directory or storage space where your projects can live. Sometimes GitHub users shorten this to “repo.” It can be local to a folder on your computer, or it can be a storage space on GitHub or another online host. You can keep code files, text files, image files, you name it, inside a repository.

Commit: This is the command that gives Git its power. When you commit, you are taking a “snapshot” of your repository at that point in time, giving you a checkpoint to which you can re-evaluate or restore your project to any previous state.

 

Terminologies(cont...)

Branch: How do multiple people work on a project at the same time without Git getting them confused? Usually, they “branch off” of the main project with their own versions full of changes they themselves have made. After they’re done, it’s time to “merge” that branch back with the “master,” the main directory of the project.

Basic git commands

git init: Initializes a new Git repository. Until you run this command inside a repository or directory, it’s just a regular folder. Only after you input this does it accept further Git commands.

git config: Short for “configure,” this is most useful when you’re setting up Git for the first time.

git help: Forgot a command? Type this into the command line to bring up the 21 most common git commands. You can also be more specific and type “git help init” or another term to figure out how to use and configure a specific git command.

Basic git commands(cont..)

git status: Check the status of your repository. See which files are inside it, which changes still need to be committed, and which branch of the repository you’re currently working on.

git add: This does not add new files to your repository. Instead, it brings new files to Git’s attention. After you add files, they’re included in Git’s “snapshots” of the repository.

git commit: Git’s most important command. After you make any sort of change, you input this in order to take a “snapshot” of the repository. Usually it goes git commit -m “Message here.” The -m indicates that the following section of the command should be read as a message.

Basic git commands(cont..)

git branch: Working with multiple collaborators and want to make changes on your own? This command will let you build a new branch, or timeline of commits, of changes and file additions that are completely your own. Your title goes after the command. If you wanted a new branch called “cats,” you’d type git branch cats.

git checkout: Literally allows you to “check out” a repository that you are not currently inside. This is a navigational command that lets you move to the repository you want to check. You can use this command as git checkout master to look at the master branch, or git checkout cats to look at another branch.

git diff: See the changes that you have made.

Basic git commands(cont..)

git push: If you’re working on your local computer, and want your commits to be visible online on GitHub as well, you “push” the changes up to GitHub with this command.

git pull: If you’re working on your local computer and want the most up-to-date version of your repository to work with, you “pull” the changes down from GitHub with this command.

git merge: When you’re done working on a branch, you can merge your changes back to the master branch, which is visible to all collaborators. git merge cats would take all the changes you made to the “cats” branch and add them to the master.

Want a demo?

GitHub, the fb for dev

  • What is GitHub?
  • hello world in GitHub
  • Features specific to GitHub

What is GitHub?

GitHub is a web-based Git repository hosting service, which offers source code management functionality of Git as well as adding its own features. Unlike Git, which is strictly a command-line tool, GitHub provides a web-based graphical interface. It also provides access control and several collaboration features such as wikis, task management, and bug tracking and feature requests for every project.

hello world in GitHub

1. Create an account in GitHub

2. Create a new repo

3.                  to get a local copy

$ git clone

4. Add the files locally.

5. Commit any changes.

6. Push it to GitHub

Official GitHub hello-world tutorial here

Features specific to GitHub

  • Issues - To keep track of  the bug.
  • Fork - Own a copy of else's project.

  • Pull request - Send in your contribution for review.

  • Other features - follow, star, watch, etc.

Some advanced features!

git rebase : play with the history

  • Can reorder commits
  • Can edit commits
  • Can "squash" one commit to another

Let's try it out!

Open Source, SymPy <3

  • Fork an interested repo.
  • Work on your fork.
  • Send in a PR, get it merged.

Ta-da you are an open-source contributor

Fundae for open source.

  • Pick the right organization. "Enthu" matters.
  • Thumb rule : Work on easy bugs first.
  • Don't be intimidated by the code base, of the hundreds of contributors, just a handful know the whole thing.
  • Don't be afraid to ask questions. No contributor is there to work. Everybody is there to learn, they will be more than willing to help.

SymPy

A symbolic computational library

What?

Mathematical library that handles symbols than numbers. So you can do things like

integrate(sin(x) + cos(x)**2, x)

and things much more complicated

A simple pythonic open source library alternative for Wolfram

import sympy

And as simple as

Some features!

Example: Laplace Transforms

>>> from sympy.integrals import laplace_transform
>>> from sympy.abc import t, s, a
>>> laplace_transform(t**a, t, s)
(s**(-a)*gamma(a + 1)/s, 0, -re(a) < 1)

Core capabilities|Polynomials |Calculus

         Solving equations |Combinatorics |Discrete math

          Matrices |Geometric Algebra| Geometry |Plotting |Physics 

Statistics| Cryptography| Parsing |Printing

Hope you enjoyed!

"People who say alcohol is addictive, probably haven't tried their hands at FOSS." - Ranveer

Happy forking

Catch me at

Github : Sumith1896

Facebook : sumith.iitb

Email : sumith1896@gmail.com

* Godspeed *

Intro to git

By Sumith Kulal

Intro to git

Introduction to git by Web and Coding Club, IIT Bombay

  • 2,202