Don’t be afraid to commit – Software Lab Presentation – WhatsApp



Don’t be afraid to commit – Software Lab Presentation – WhatsApp

0 0


SWLPresentation


On Github VireshDhawan / SWLPresentation

Don’t be afraid to commit

Software Lab Presentation

Created by Viresh Dhawan / @vires

Agenda for the day

  • Food For Thought
  • Git and Github Commands
  • Make yourself a game hands-on

TAKE A MOMENT

Let us discuss Software First

WhatsApp

Imgur

Instagram

The new normal

fewer engineers and dollars to ship code to more users than ever before

Point of View being

As the leverage of the individual software engineer increases, the barriers to becoming a code creator are falling fast. The same software foundation (open source software, development tools like Github, infrastructure as a service provided by the likes of Digital Ocean, and more) that allowed Whatsapp and Imgur to scale, means that experience and skill writing software become less important.

it’s all chugging away

individual can now scale a web app to millions of users with Digital Ocean, Heroku and AWS

no longer requires a sophisticated understanding of MySQL parameters to scale a database on Google App Engine

no longer requires a knowledge of the CPU chip

Divide the stages

pre-foundation

where every piece of software started in Assembly

post-foundation

where software is like Legos, just snap the pieces together

Tabular Tables

Pre-open source maturity(~1990) Pre-AWS(~2005) Today Google Facebook WhatsApp Yahoo Twitter Imgur EBay Youtube Instagram

Here is Brad Cox, the creator of Objective-C, writing 25 years ago

“Mature industries like plumbing are less complex than ours, not because software is intrinsically more complicated, but because they—and not we —have solved their complexity, nonconformity, and changeability problems by using a producer/consumer hierarchy to distribute these problems across time and organizational space”

Enough Talks

let's get started

Git

Github

Git

  • An open source (GNU GPL V2) VCS designed for speed and efficiency
  • Created by Linus Torvalds (for managing Linux kernel)
  • Branching (lightweight & fast)
  • Used on personal or very large projects, and for all size of teams

Getting Git

Download the software - it's free

Download a GUI, optional

Understanding Git Workflow

Obtain a repository

Either via git init, or git clone, or if you already have the repo, pull changes!

Make some edits

Use your favorite text editor or source code IDE(Most IDEs have Git integration, including netbeans)

Stage your changes

using git add

Commit your work

git commit -m "Always write clear commit messages!"

Push to remote

git push remotename localbranch:remotebranch

Check installation

Check if Git is installed:

$ git --version

Set your Git username and email to your global config:

$ git config --global user.name "swlproject"
$ git config --global user.email "swlproject@reallymymail.com"

Obtaining a repository

Creating a repository (if one does not exist remotely):

$ git init

cloning a remote repository:

$ git clone https://github.com/phpguru/phpredis.git
$ cd phpredis
$ ls –la

Inspecting your repo

Change Directory into the repository & issue a git status

$ cd path/to/repo
$ git status

shows what you added, modified or deleted since your last commit.

Change Directory into the repository & issue a git log

$ cd path/to/repo
$ git log
$ git log --pretty=oneline
$ git log -1

Shows the commit logs, why you committed something

Hopefully you wrote descriptive commit messages in the past!

Making Edits & Committing

You can use whatever program you normally use to edit files Make a new file - newfile.txt Edit the file as desired Save it in your working directory
$ git status

will show the file as "Changes not staged for commit"

$ git add newfile.txt
$ git status

will show newfile.txt as "Changes to be committed"

$git commit -m "Added newfile.txt as an example"
[Master 1e77a20] Added newfile.txt as an example
1 file changed, 0 insertions(+), 0 deletions(-)

Adding (staging) changes

Change Directory into the repository & issue a git status, then add new/modified files

$ cd path/to/repo
$ git add (file)
$ git add –A

This command updates the index using the current content found in the working tree, to prepare the content staged for the next commit

Committing (staged) changes

Change Directory into the repository & issue a git status, then add new/modified files, then commit them to your local repository

$ cd path/to/repo
$ git add (file)
$ git commit -m "What did you change? Log messages matter."

Stores the current contents of the index in a new commit along with a log message from the user describing the changes

Pushing

At this point, none of those changes you've made have left your computer.Let's push those changes to the remote repo.

$ git push {repository}{refspec}
$ git push origin master
$ git push origin master:master

As a rule of thumb, commit every hour, push every day

After you commit, your colleagues can pull changes down from the origin repository to their local working repository

Try a hands-on

Clone the remote repository:

$ git clone https://github.com/gabrielecirulli/2048
Cloning into '2048'...
remote: Counting objects: 1176, done.
remote: Total 1176 (delta 0), reused 0 (delta 0), pack-reused 1176
Receiving objects: 100% (1176/1176), 556.45 KiB | 115.00 KiB/s, done.
Resolving deltas: 100% (686/686), done.
Checking connectivity... done.

Sign-in to your Github account and make a new repository:

{username}.github.io

Change directory to navigate into the project:

$ cd 2048

Add the files in your new local repository:

$ git init
$ git add .

Commit the files that you've staged in your local repository:

$ git commit -m 'First commit'

add the URL for the remote repository where your local repository will be pushed:

$ git remote rm origin
$ git remote add origin https://github.com/swlproject/swlproject.github.io.git

Push the changes in your local repository to GitHub:

$ git push origin master
Username for 'https://github.com': swlproject
Password for 'https://swlproject@github.com':
Counting objects: 744, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (319/319), done.
Writing objects: 100% (744/744), 434.69 KiB | 0 bytes/s, done.
Total 744 (delta 422), reused 744 (delta 422)
To https://github.com/swlproject/swlproject.github.io.git
* [new branch]      master -> master
Don’t be afraid to commit Software Lab Presentation Created by Viresh Dhawan / @vires