SlideShare a Scribd company logo
1 of 30
GIT Intro and usage on
Windows - Basic
By Geshan Manandhar
http://geshan.blogspot.com
1http://geshan.blogspot.com
Agenda
 What is git
 Who uses it, features
 How to use git on windows
 Prepare working directory
 Create public repository
 Add, commit, pull, push
 Git ignore
 Other commands and things to look at
http://geshan.blogspot.com 2
GIT is
 a free & open source, distributed
version control system.
 designed to handle everything from small
to very large projects with speed and
efficiency.
 a developer’s friend in a multi
developer environment.
 a must tool to go back in history to what
you coded and see the code changes
made in the timeline.
3http://geshan.blogspot.com
Who uses GIT
 Many big names including
◦ Linux/Kernel
◦ Eclipse
◦ Ruby on Rails
◦ Android
◦ PostgreSQL
◦ Git itself.
4http://geshan.blogspot.com
Why use Git/ Features
 Fast
 Distributed (no central repository)
 Can work offline
 Small (file system usage)
 Has a staging area
 Access control (with gitosis)
 Fit for any project size
 Branching, tags …
 GitHub.com
◦ Reference: http://whygitisbetterthanx.com
5http://geshan.blogspot.com
Distributed??
 No Central
repository
 All developers
have a working
copy and own
private repo (.git)
 Code transfer
should be done on
non-private repo.
http://geshan.blogspot.com 6
Image Source:
http://coding.smashingmagazine.c
om/2011/07/26/modern-version-
control-with-git-series/
How to use on windows?
 Could not find mature GUI tools like
tortoise SVN.
 Integrated in Eclipse (with plugin) and
NetBeans (good colorful support).
 If you are programmer, you are not
scared of the command line so:
 Download MsysGit :
http://code.google.com/p/msysgit/dow
nloads/list
http://geshan.blogspot.com 7
MsysGit for git on Windows
http://geshan.blogspot.com 8
Steps:
1. Download the exe file (or the portable one, it will not need
installation).
2. Install msysgit , next … next is your friend here with finish – no
need of any fancy configuration.
3. Run the git bash application.
Git bash part of MsysGit
http://geshan.blogspot.com 9
User and line settings for win
 If you are familiar with ~ of unix systems
this might be easy.
 Make sure where your home dir is in
your windows setup like:
◦ /c/users/Geshan – for me in Windows 7
 Set ~/.bash_profile if you want.(google
bash profiles and dot files, if you want to)
 Run this: git config --global core.autocrlf true
 Have a look for new line setting if need be:
http://github.com/guides/dealing-with-newlines-in-git
http://geshan.blogspot.com 10
Introduce yourself to GIT
 execute commands in bash
◦ git config --global user.name <name>
◦ git config --global user.email <email>
◦ (this gets written to your ~/.gitconfig file)
 Example
◦ git config --global user.name “Geshan
Manadhar”
◦ git config --global user.email
“me@somedomain.com”
http://geshan.blogspot.com 11
Some conceptual clarity
 You have a working directory and your
private repo (a .git folder in your dir)
 You always push your changes and
pull changes from another non-private
repository.
http://geshan.blogspot.com 12
Working Dir with git
Public git repo on file system
Preparing your working dir
http://geshan.blogspot.com 13
Nothing significant just created a directory with a file that’s it.
Preparing working dir 2
http://geshan.blogspot.com 14
Working directory made
 Commands used
◦ git init ; to initialize the current dir for git
tracking.
◦ git status; shows current status
◦ git add; put files to stating area
 Variations like
 Git add . ; . Is for all changed files
 Git add /path/to/file ; /c/dir1/file1.txt
 Git add /path/a.*
 etc
http://geshan.blogspot.com 15
First commit
http://geshan.blogspot.com 16
git commit –m “message”;
Files have been put into the local repository (the .git dir
created with git init)
All things are in local so we need to push things to a non-
private repository. For this example I’ll create a local
repository.
Always remember to write concise but meaningful
commit messages.
Creating public repository
http://geshan.blogspot.com 17
A bare passive public repo has been created for pushing code.
Remember the path is /c/users/geshan/gitrepos/testgit.git
Different command : git init --bare;
Now we will link the working directory with this public repo.
Linking working dir with public
repo
http://geshan.blogspot.com 18
Remote repository created in previous slide linked to the working directory.
git remote add <name> <path>
Path can be:
File : /home/geshan/gitrepost/testrepo.git
Remote file: ssh://user1@domain1.com/home/user1/gitrepos/test.git
Gitosis: git@domain1.com:test.git
First push to remote repo
 git push <repo_name>
<branch_name>
 Repo_name is just a alias to the path.
 git push origin master
◦ Default repo when cloned in origin and
default branch is master.
http://geshan.blogspot.com 19
First pull attempt
 Pull is done to get the changes done
by others in the self working directory.
 git pull <repo_name> <branch_name>
 git pull origin master
http://geshan.blogspot.com 20
.gitignore file
 .gitignore file is generally placed in the
root of the working directory.
 As the name suggests it can ignore
certain files from git.
 Generally local config is ignored but a
back up is kept for others, example
database username password config.
http://geshan.blogspot.com 21
Using .gitignore
http://geshan.blogspot.com 22
Scenario:
Local database
settings are
stored in
database.php
file
Continue to push bkp file
http://geshan.blogspot.com 23
Pull by a new developer
http://geshan.blogspot.com 24
A new
developer
will
generally
clone the
project,
than
create
new files.
-Notice
git remote
–v
Git branch
shows
available
branches.
Scenario dev 2 posts code
 Dev 2 changed test.txt and pushed his
code to public repo.
http://geshan.blogspot.com 25
Dev 1 pulled the changes.
 Dev 1 can immediately have the
changed code.
http://geshan.blogspot.com 26
Gitk to know what changed
 execute gitk on a git repo root to get
this.
http://geshan.blogspot.com 27
Other git commands
 git log
 git short log –sne
 git checkout / git branch –b newbranch
 git tag v 1.0 –a “test”
 git fsck
 git push dev feature1; - testing you.
http://geshan.blogspot.com 28
Things to look at
 Reset the code to old version
 Branching with git
 Tagging with git
 How to handle conflict situation
 Other git features and commands
 Check out the git cheat sheet:
http://www.cheat-sheets.org/saved-
copy/git-cheat-sheet.pdf
 For details of hashing etc check the git
internals book.
http://geshan.blogspot.com 29
Happy Git-ing
 Google git
 See videos on youtube
 Find some good podcasts on git
 You will like what you use
http://geshan.blogspot.com 30

More Related Content

What's hot (20)

Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git advanced
Git advancedGit advanced
Git advanced
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Git introduction
Git introductionGit introduction
Git introduction
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
Git 101
Git 101Git 101
Git 101
 
From svn to git
From svn to gitFrom svn to git
From svn to git
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
What the Git? - WordCamp Atlanta
What the Git? - WordCamp AtlantaWhat the Git? - WordCamp Atlanta
What the Git? - WordCamp Atlanta
 
Git training with Devaamo
Git training with DevaamoGit training with Devaamo
Git training with Devaamo
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Version control
Version controlVersion control
Version control
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 

Viewers also liked

06 Php Mysql Connect Query
06 Php Mysql Connect Query06 Php Mysql Connect Query
06 Php Mysql Connect QueryGeshan Manandhar
 
07 Php Mysql Update Delete
07 Php Mysql Update Delete07 Php Mysql Update Delete
07 Php Mysql Update DeleteGeshan Manandhar
 
Technology at tutorials
Technology at tutorialsTechnology at tutorials
Technology at tutorialsNigel Gibson
 
Business Rules Logical Experssion and SBVR
Business Rules Logical Experssion and SBVRBusiness Rules Logical Experssion and SBVR
Business Rules Logical Experssion and SBVRGeshan Manandhar
 
Embrace chatops, stop installing deployment software - Laracon EU 2016
Embrace chatops, stop installing deployment software - Laracon EU 2016Embrace chatops, stop installing deployment software - Laracon EU 2016
Embrace chatops, stop installing deployment software - Laracon EU 2016Geshan Manandhar
 

Viewers also liked (6)

Google apps
Google appsGoogle apps
Google apps
 
06 Php Mysql Connect Query
06 Php Mysql Connect Query06 Php Mysql Connect Query
06 Php Mysql Connect Query
 
07 Php Mysql Update Delete
07 Php Mysql Update Delete07 Php Mysql Update Delete
07 Php Mysql Update Delete
 
Technology at tutorials
Technology at tutorialsTechnology at tutorials
Technology at tutorials
 
Business Rules Logical Experssion and SBVR
Business Rules Logical Experssion and SBVRBusiness Rules Logical Experssion and SBVR
Business Rules Logical Experssion and SBVR
 
Embrace chatops, stop installing deployment software - Laracon EU 2016
Embrace chatops, stop installing deployment software - Laracon EU 2016Embrace chatops, stop installing deployment software - Laracon EU 2016
Embrace chatops, stop installing deployment software - Laracon EU 2016
 

Similar to Git intro hands on windows with msysgit

Similar to Git intro hands on windows with msysgit (20)

Setting up Git.pptx
Setting up Git.pptxSetting up Git.pptx
Setting up Git.pptx
 
1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Git and github
Git and githubGit and github
Git and github
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git and Github.pptx
Git and Github.pptxGit and Github.pptx
Git and Github.pptx
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Git
GitGit
Git
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 

More from Geshan Manandhar

Are logs a software engineer’s best friend? Yes -- follow these best practices
Are logs a software engineer’s best friend? Yes -- follow these best practicesAre logs a software engineer’s best friend? Yes -- follow these best practices
Are logs a software engineer’s best friend? Yes -- follow these best practicesGeshan Manandhar
 
We lost $ 20.5K in one day and how we could have saved it… hint: better autom...
We lost $ 20.5K in one day and how we could have saved it… hint: better autom...We lost $ 20.5K in one day and how we could have saved it… hint: better autom...
We lost $ 20.5K in one day and how we could have saved it… hint: better autom...Geshan Manandhar
 
Moving from A and B to 150 microservices, the journey, and learnings
Moving from A and B to 150 microservices, the journey, and learningsMoving from A and B to 150 microservices, the journey, and learnings
Moving from A and B to 150 microservices, the journey, and learningsGeshan Manandhar
 
Adopt a painless continuous delivery culture, add more business value
Adopt a painless continuous delivery culture, add more business valueAdopt a painless continuous delivery culture, add more business value
Adopt a painless continuous delivery culture, add more business valueGeshan Manandhar
 
Things i wished i knew as a junior developer
Things i wished i knew as a junior developerThings i wished i knew as a junior developer
Things i wished i knew as a junior developerGeshan Manandhar
 
Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...
Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...
Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...Geshan Manandhar
 
Embrace chatOps, stop installing deployment software
Embrace chatOps, stop installing deployment softwareEmbrace chatOps, stop installing deployment software
Embrace chatOps, stop installing deployment softwareGeshan Manandhar
 
7 rules of simple and maintainable code
7 rules of simple and maintainable code7 rules of simple and maintainable code
7 rules of simple and maintainable codeGeshan Manandhar
 
Software engineering In Nepal mid 2015 part 01
Software engineering In Nepal mid 2015 part 01Software engineering In Nepal mid 2015 part 01
Software engineering In Nepal mid 2015 part 01Geshan Manandhar
 
How to become a better software company technically
How to become a better software company technicallyHow to become a better software company technically
How to become a better software company technicallyGeshan Manandhar
 
Things I wished I knew while doing my tech bachelor / undergraduate
Things I wished I knew while doing my tech bachelor / undergraduateThings I wished I knew while doing my tech bachelor / undergraduate
Things I wished I knew while doing my tech bachelor / undergraduateGeshan Manandhar
 
Message Queues a basic overview
Message Queues a basic overviewMessage Queues a basic overview
Message Queues a basic overviewGeshan Manandhar
 
Most popular brands, people on facebook in nepal as of 2013 q4
Most popular brands, people on facebook in nepal as of 2013 q4Most popular brands, people on facebook in nepal as of 2013 q4
Most popular brands, people on facebook in nepal as of 2013 q4Geshan Manandhar
 
Drupal 7 basic setup and contrib modules for a brochure website
Drupal 7 basic setup and contrib modules for a brochure websiteDrupal 7 basic setup and contrib modules for a brochure website
Drupal 7 basic setup and contrib modules for a brochure websiteGeshan Manandhar
 
Drupal 7 install with modules and themes
Drupal 7 install with modules and themesDrupal 7 install with modules and themes
Drupal 7 install with modules and themesGeshan Manandhar
 
Drupal A non technical Introduction
Drupal A non technical IntroductionDrupal A non technical Introduction
Drupal A non technical IntroductionGeshan Manandhar
 

More from Geshan Manandhar (20)

Are logs a software engineer’s best friend? Yes -- follow these best practices
Are logs a software engineer’s best friend? Yes -- follow these best practicesAre logs a software engineer’s best friend? Yes -- follow these best practices
Are logs a software engineer’s best friend? Yes -- follow these best practices
 
We lost $ 20.5K in one day and how we could have saved it… hint: better autom...
We lost $ 20.5K in one day and how we could have saved it… hint: better autom...We lost $ 20.5K in one day and how we could have saved it… hint: better autom...
We lost $ 20.5K in one day and how we could have saved it… hint: better autom...
 
Moving from A and B to 150 microservices, the journey, and learnings
Moving from A and B to 150 microservices, the journey, and learningsMoving from A and B to 150 microservices, the journey, and learnings
Moving from A and B to 150 microservices, the journey, and learnings
 
Adopt a painless continuous delivery culture, add more business value
Adopt a painless continuous delivery culture, add more business valueAdopt a painless continuous delivery culture, add more business value
Adopt a painless continuous delivery culture, add more business value
 
Things i wished i knew as a junior developer
Things i wished i knew as a junior developerThings i wished i knew as a junior developer
Things i wished i knew as a junior developer
 
Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...
Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...
Do You Git Your Code? Follow Simplified Gitflow Branching Model to Improve Pr...
 
Embrace chatOps, stop installing deployment software
Embrace chatOps, stop installing deployment softwareEmbrace chatOps, stop installing deployment software
Embrace chatOps, stop installing deployment software
 
7 rules of simple and maintainable code
7 rules of simple and maintainable code7 rules of simple and maintainable code
7 rules of simple and maintainable code
 
Software engineering In Nepal mid 2015 part 01
Software engineering In Nepal mid 2015 part 01Software engineering In Nepal mid 2015 part 01
Software engineering In Nepal mid 2015 part 01
 
A simplified Gitflow
A simplified GitflowA simplified Gitflow
A simplified Gitflow
 
How to become a better software company technically
How to become a better software company technicallyHow to become a better software company technically
How to become a better software company technically
 
Things I wished I knew while doing my tech bachelor / undergraduate
Things I wished I knew while doing my tech bachelor / undergraduateThings I wished I knew while doing my tech bachelor / undergraduate
Things I wished I knew while doing my tech bachelor / undergraduate
 
Message Queues a basic overview
Message Queues a basic overviewMessage Queues a basic overview
Message Queues a basic overview
 
Most popular brands, people on facebook in nepal as of 2013 q4
Most popular brands, people on facebook in nepal as of 2013 q4Most popular brands, people on facebook in nepal as of 2013 q4
Most popular brands, people on facebook in nepal as of 2013 q4
 
Drupal 7 basic setup and contrib modules for a brochure website
Drupal 7 basic setup and contrib modules for a brochure websiteDrupal 7 basic setup and contrib modules for a brochure website
Drupal 7 basic setup and contrib modules for a brochure website
 
Drupal 7 install with modules and themes
Drupal 7 install with modules and themesDrupal 7 install with modules and themes
Drupal 7 install with modules and themes
 
Drupal introduction
Drupal introductionDrupal introduction
Drupal introduction
 
No sql
No sqlNo sql
No sql
 
Drupal A non technical Introduction
Drupal A non technical IntroductionDrupal A non technical Introduction
Drupal A non technical Introduction
 
01 Php Introduction
01 Php Introduction01 Php Introduction
01 Php Introduction
 

Recently uploaded

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 

Recently uploaded (20)

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 

Git intro hands on windows with msysgit

  • 1. GIT Intro and usage on Windows - Basic By Geshan Manandhar http://geshan.blogspot.com 1http://geshan.blogspot.com
  • 2. Agenda  What is git  Who uses it, features  How to use git on windows  Prepare working directory  Create public repository  Add, commit, pull, push  Git ignore  Other commands and things to look at http://geshan.blogspot.com 2
  • 3. GIT is  a free & open source, distributed version control system.  designed to handle everything from small to very large projects with speed and efficiency.  a developer’s friend in a multi developer environment.  a must tool to go back in history to what you coded and see the code changes made in the timeline. 3http://geshan.blogspot.com
  • 4. Who uses GIT  Many big names including ◦ Linux/Kernel ◦ Eclipse ◦ Ruby on Rails ◦ Android ◦ PostgreSQL ◦ Git itself. 4http://geshan.blogspot.com
  • 5. Why use Git/ Features  Fast  Distributed (no central repository)  Can work offline  Small (file system usage)  Has a staging area  Access control (with gitosis)  Fit for any project size  Branching, tags …  GitHub.com ◦ Reference: http://whygitisbetterthanx.com 5http://geshan.blogspot.com
  • 6. Distributed??  No Central repository  All developers have a working copy and own private repo (.git)  Code transfer should be done on non-private repo. http://geshan.blogspot.com 6 Image Source: http://coding.smashingmagazine.c om/2011/07/26/modern-version- control-with-git-series/
  • 7. How to use on windows?  Could not find mature GUI tools like tortoise SVN.  Integrated in Eclipse (with plugin) and NetBeans (good colorful support).  If you are programmer, you are not scared of the command line so:  Download MsysGit : http://code.google.com/p/msysgit/dow nloads/list http://geshan.blogspot.com 7
  • 8. MsysGit for git on Windows http://geshan.blogspot.com 8 Steps: 1. Download the exe file (or the portable one, it will not need installation). 2. Install msysgit , next … next is your friend here with finish – no need of any fancy configuration. 3. Run the git bash application.
  • 9. Git bash part of MsysGit http://geshan.blogspot.com 9
  • 10. User and line settings for win  If you are familiar with ~ of unix systems this might be easy.  Make sure where your home dir is in your windows setup like: ◦ /c/users/Geshan – for me in Windows 7  Set ~/.bash_profile if you want.(google bash profiles and dot files, if you want to)  Run this: git config --global core.autocrlf true  Have a look for new line setting if need be: http://github.com/guides/dealing-with-newlines-in-git http://geshan.blogspot.com 10
  • 11. Introduce yourself to GIT  execute commands in bash ◦ git config --global user.name <name> ◦ git config --global user.email <email> ◦ (this gets written to your ~/.gitconfig file)  Example ◦ git config --global user.name “Geshan Manadhar” ◦ git config --global user.email “me@somedomain.com” http://geshan.blogspot.com 11
  • 12. Some conceptual clarity  You have a working directory and your private repo (a .git folder in your dir)  You always push your changes and pull changes from another non-private repository. http://geshan.blogspot.com 12 Working Dir with git Public git repo on file system
  • 13. Preparing your working dir http://geshan.blogspot.com 13 Nothing significant just created a directory with a file that’s it.
  • 14. Preparing working dir 2 http://geshan.blogspot.com 14
  • 15. Working directory made  Commands used ◦ git init ; to initialize the current dir for git tracking. ◦ git status; shows current status ◦ git add; put files to stating area  Variations like  Git add . ; . Is for all changed files  Git add /path/to/file ; /c/dir1/file1.txt  Git add /path/a.*  etc http://geshan.blogspot.com 15
  • 16. First commit http://geshan.blogspot.com 16 git commit –m “message”; Files have been put into the local repository (the .git dir created with git init) All things are in local so we need to push things to a non- private repository. For this example I’ll create a local repository. Always remember to write concise but meaningful commit messages.
  • 17. Creating public repository http://geshan.blogspot.com 17 A bare passive public repo has been created for pushing code. Remember the path is /c/users/geshan/gitrepos/testgit.git Different command : git init --bare; Now we will link the working directory with this public repo.
  • 18. Linking working dir with public repo http://geshan.blogspot.com 18 Remote repository created in previous slide linked to the working directory. git remote add <name> <path> Path can be: File : /home/geshan/gitrepost/testrepo.git Remote file: ssh://user1@domain1.com/home/user1/gitrepos/test.git Gitosis: git@domain1.com:test.git
  • 19. First push to remote repo  git push <repo_name> <branch_name>  Repo_name is just a alias to the path.  git push origin master ◦ Default repo when cloned in origin and default branch is master. http://geshan.blogspot.com 19
  • 20. First pull attempt  Pull is done to get the changes done by others in the self working directory.  git pull <repo_name> <branch_name>  git pull origin master http://geshan.blogspot.com 20
  • 21. .gitignore file  .gitignore file is generally placed in the root of the working directory.  As the name suggests it can ignore certain files from git.  Generally local config is ignored but a back up is kept for others, example database username password config. http://geshan.blogspot.com 21
  • 22. Using .gitignore http://geshan.blogspot.com 22 Scenario: Local database settings are stored in database.php file
  • 23. Continue to push bkp file http://geshan.blogspot.com 23
  • 24. Pull by a new developer http://geshan.blogspot.com 24 A new developer will generally clone the project, than create new files. -Notice git remote –v Git branch shows available branches.
  • 25. Scenario dev 2 posts code  Dev 2 changed test.txt and pushed his code to public repo. http://geshan.blogspot.com 25
  • 26. Dev 1 pulled the changes.  Dev 1 can immediately have the changed code. http://geshan.blogspot.com 26
  • 27. Gitk to know what changed  execute gitk on a git repo root to get this. http://geshan.blogspot.com 27
  • 28. Other git commands  git log  git short log –sne  git checkout / git branch –b newbranch  git tag v 1.0 –a “test”  git fsck  git push dev feature1; - testing you. http://geshan.blogspot.com 28
  • 29. Things to look at  Reset the code to old version  Branching with git  Tagging with git  How to handle conflict situation  Other git features and commands  Check out the git cheat sheet: http://www.cheat-sheets.org/saved- copy/git-cheat-sheet.pdf  For details of hashing etc check the git internals book. http://geshan.blogspot.com 29
  • 30. Happy Git-ing  Google git  See videos on youtube  Find some good podcasts on git  You will like what you use http://geshan.blogspot.com 30