Ahmed Murtaza

ahmedgmurtaza

codesandbox.io/u/Ahmedgmurtaza

codepen.io/ahmedgmurtaza

slides.com/ahmedmurtaza

ahmedgmurtaza

Introduction to Git

  • help a software team manage changes to source code over time

  • keeps track of every modification to the code

  • Incase of any mistake, developers can turn back to earlier versions of the code

slides.com/ahmedmurtaza

VCS

Distributed version controlled system

 

slides.com/ahmedmurtaza

GIT

Famous tools:

git init, git clone, .gitignore, git add, git status, git commit, git push, git pull, git branch, git checkout

what we will cover here

slides.com/ahmedmurtaza

Step # 1

slides.com/ahmedmurtaza

https://git-scm.com/downloads

install git client from following link

Git workflow

slides.com/ahmedmurtaza

slides.com/ahmedmurtaza

Git init
  • The git init command creates a new Git repository
  •  convert an existing, unversioned project to a Git repository or initialize a new, empty repository
  • Most other Git commands are not available outside of an initialized repository

slides.com/ahmedmurtaza

Git clone
  • target an existing repository and create a clone
  • no need to run Git init, if not previously git initialised

slides.com/ahmedmurtaza

create .gitignore file

add files which does not need to be tracked

#Directories
node_modules/
bower_components/

#Files
*.txt
npm-debug.log*

Try

gitignore.io

slides.com/ahmedmurtaza

  • The git add command adds a change in the working directory to the staging area
Git add
  • The git add command adds a change in the working directory to the staging area
git add hello.js
git add *.js
git add .

slides.com/ahmedmurtaza

  • To view the state of the working directory and the staging area
Git status
git status

slides.com/ahmedmurtaza

  • git add doesn't really affect the repository in any significant way—changes are not actually recorded until you run git commit
Git commit 
git commit -m "commit desc"

slides.com/ahmedmurtaza

  • The git push command is used to upload local repository content to a remote repository
Git push
git push

slides.com/ahmedmurtaza

  • The git pull command is used to fetch and download content from a remote repository and immediately update the local repository
Git pull
git pull

slides.com/ahmedmurtaza

  • When you want to add a new feature or fix a bug, no matter how big or how small, you spawn a new branch to encapsulate your changes
Git branch

 

git branch feature-name (new branches)
git branch (list branches)
git branch -D feature-name (delete branch)

slides.com/ahmedmurtaza

  • The git checkout command lets you navigate between the branches
Git checkout branch

 

git checkout branch-name (new branches)

slides.com/ahmedmurtaza

Thank You

Introduction to git

By Ahmed Murtaza

Introduction to git

what is git, vcs, git clients, tools, commands. Git init, git commit, git add, git pull, git push and more basic commands in git ecosystem.

  • 252