際際滷

際際滷Share a Scribd company logo
A Distributed Version Controlling
System
BUET Systems Analysis, Design & Development Group
Md. Maksud Alam Chowdhury
CSE ,BUET
mc65799@gmail.com
Bsadd training-git
 A version controlling system
 Distributed
 Most popular software for managing
codebases
 Support for remote collaboration
Bsadd training-git
 Remove millions of backup folder
 Smartly merge separate codes
 Track day to day changes of codes
 Small changes wont destroy whole
project
 Disk crash or virus wont hamper your
codes ever !!!!!!!!!!!!!
Bsadd training-git
Bsadd training-git
Bsadd training-git
 Branching & Merging (to be discussed widely)
 Small & Fast
 Distributed
 Free & Open Source
Bsadd training-git
 Standalone version:
http://git-scm.com/downloads
 Portable version:
https://code.google.com/p/msysgit/downloa
ds/list
 They both have command line interface .
Bsadd training-git
 Navigate to your project folder
 Right Click on Folder-> Git Bash
 It will open a shell
Bsadd training-git
 Type git init to initialize a git repo on your
project folder.
 Having existing codes wont cause problem
 In most cases , you will create a repo where you
have your codes.
 Note that we are in master branch by default
 We will discuss it later on branching.
Bsadd training-git
 Lets add some files
(not needed in case already have existing codes)
 Lets create a.cpp , b.txt , c.cpp in the
DemoApp Folder.
 Add some dummy texts on them
 Current Working Directory
DemoApp/
|--a.cpp
|--b.txt
|--c.cpp
Bsadd training-git
 So we think our app is stable right now.
 So we need to commit the files to be
preserved
 Type git add .
 Type
git commit am message describing commit
 So git will have save current codes as the latest
stable code on master branch
Bsadd training-git
 We can check the status of the current
condition of codes by typing
git status
 Every commit is saved uniquely with a
number
 You can switch back to any previous commit
any time
Bsadd training-git
Bsadd training-git
 By Default we are in the master branch which is
root .
 Branches are independent of each other
 Enough talking !!!!!!
 Lets create another branch dev which is a
development version.
 We will experiment in the dev branch where as
fully stable codes will be in master branch
 Type
git checkout b dev
 It will create a new branch dev and switch to
dev branch
 The new branch will contain exact copy from
where we created it.
 Any change we do now in the working
directory , after commit will go for dev
branch
Bsadd training-git
 Lets change the content of b.txt and create
d.txt
 So we have changed b.txt and added d.txt
 Now Type
git status
Bsadd training-git
 We now commit the current working directory
 So Type Again
git add .
git commit am commit message
Bsadd training-git
 Lets switch back to the master branch
 Type
git checkout master
 It will restore the master branch codes
 Note that b.txt is restored & d.txt is gone
 So you have two separate version of codes
On Master Branch On dev branch
Bsadd training-git
 So we were in the master branch again
 We are sure to merge the dev branch into
master branch
 Type
git merge dev
Bsadd training-git
 Surprisingly there is no conflict in b.txt
 Because until now you are the only person
who changed the branch in local workstation
Bsadd training-git
 We need a central place to synchronize the
team members repositories
 Github , Bitbucket , gitorious , Assembla ,
repositoryhosting etc.
 Github only provides public repo
 If you dont want it to be public go for
Bitbucket
https://bitbucket.org/account/signup/
Bsadd training-git
Bsadd training-git
Bsadd training-git
Bsadd training-git
Bsadd training-git
 Similarly as previous slide
 Type
git push origin dev
Bsadd training-git
Bsadd training-git
 There are several mechanisms [try googling]
 We will show an easy approach for small
teams
 We will maintain master for ultimate stable
version .
 Each team member will have their own branch
 After finalizing some features team members
will create a temporary branch
 The temporary branch will be incrementally
merged and tested by team captain
 But there might be conflict in configuration
files which might hamper project.
[Android menifest.xml , database settings
etc ]
 Do ignore such files while committing
 Create a .gitignore file and list the directories
or file not to be tracked
 Keep a list of changelog.txt file
 After merging master do manually change the
configurations
 Conflicts arise when You have changed your local
files and committed them in your branch
 But someone else have also changed the same
files in his own branch
 You want to merge his branch
 Git will have no way to decide which one to keep
and which one to abandon
 So it keeps both of them in a way you can
identify difference.
 We change our local file b.txt again in master
 Add , Commit it
 We pull some previous version of the same file in
dev
git pull origin dev
 Pull = fetch + merge
 Now this will create a conflict
Bsadd training-git
Bsadd training-git
 Here head is local version
 Lower part is the fetched version
 The marker is where things actually started to be
different
 It would not create a conflict if appending was
required or creating a new or deleting a file was
required
 But here a complete rewrite is required
 Git tool command
 Manually change the conflicting files
 Add, Commit , Push
 Dont Pull directly
 At first fetch (git fetch origin dev)
 See Whether any difference (git diff origin/dev)
 The decide to merge
 If you already have a repo on bitbucket or
github like the one we created
 Just type
git clone <http_link_of_project>
 So you dont need to bother about backup or
disk lost
Bsadd training-git
Bsadd training-git
 git init
 git add .
 git commit am <your commit message>
 git status
 git checkout b <New_Branch_Name>
 git checkout <Branch_Name>
 git merge <Branch_Name>
 git remote add <Name_For_Server> <Link_Of_Your_Project>
 git push <Name_For_Server> <Branch_To_Push>
 git pull <Name_For_Server> <Branch_To_Pull>
 git fetch <Name_For_Server> <Branch_To_Fetch>
 git diff <Branch_To_Compare_With_Current_Branch>
Bsadd training-git
 http://git-scm.com/
 http://gitref.org
 https://bitbucket.org
Please Email Any Question At:
mc65799@gmail.com

More Related Content

What's hot (20)

Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
Gitt and Git-flow
Gitt and Git-flowGitt and Git-flow
Gitt and Git-flow
Md. Masud
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
BrianSchilder
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
azwildcat
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
Bitbucket git-bamboo-jira
Bitbucket git-bamboo-jiraBitbucket git-bamboo-jira
Bitbucket git-bamboo-jira
lenamattt
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Parag Gajbhiye
Learning git
Learning gitLearning git
Learning git
Sid Anand
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
Matt Gauger
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
Sumin Byeon
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging Software
Chris Jean
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
Otto Kek辰l辰inen
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
Omar Fathy
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
Git,Github,How to host using Github
Git,Github,How to host using GithubGit,Github,How to host using Github
Git,Github,How to host using Github
Sujata Regoti
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
Gitt and Git-flow
Gitt and Git-flowGitt and Git-flow
Gitt and Git-flow
Md. Masud
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
BrianSchilder
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
azwildcat
Bitbucket git-bamboo-jira
Bitbucket git-bamboo-jiraBitbucket git-bamboo-jira
Bitbucket git-bamboo-jira
lenamattt
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Parag Gajbhiye
Learning git
Learning gitLearning git
Learning git
Sid Anand
Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010Matt Gauger - Git & Github web414 December 2010
Matt Gauger - Git & Github web414 December 2010
Matt Gauger
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
Sumin Byeon
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging Software
Chris Jean
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1Introduction to Git and GitHub Part 1
Introduction to Git and GitHub Part 1
Omar Fathy
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
Git,Github,How to host using Github
Git,Github,How to host using GithubGit,Github,How to host using Github
Git,Github,How to host using Github
Sujata Regoti

Similar to Bsadd training-git (20)

Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
John Tighe
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
AliaaTarek5
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
Yeasin Abedin
Git
GitGit
Git
Shinu Suresh
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
Md. Main Uddin Rony
Git github
Git githubGit github
Git github
Anurag Deb
Git cheat sheet__white
Git cheat sheet__whiteGit cheat sheet__white
Git cheat sheet__white
King Hom
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__grey
King Hom
Git cheat sheet_dark
Git cheat sheet_darkGit cheat sheet_dark
Git cheat sheet_dark
King Hom
Getting Git
Getting GitGetting Git
Getting Git
Brian Arnold
Git basics with notes
Git basics with notesGit basics with notes
Git basics with notes
Surabhi Gupta
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
Md. Ahsan Habib Nayan
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
Carlo Bernaschina
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
Manish Chakravarty
Git and Github.pptx
Git and Github.pptxGit and Github.pptx
Git and Github.pptx
Hitesh670643
Git slides
Git slidesGit slides
Git slides
Nanyak S
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
Chen-Tien Tsai
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
John Tighe
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
AliaaTarek5
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
Yeasin Abedin
Git cheat sheet__white
Git cheat sheet__whiteGit cheat sheet__white
Git cheat sheet__white
King Hom
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__grey
King Hom
Git cheat sheet_dark
Git cheat sheet_darkGit cheat sheet_dark
Git cheat sheet_dark
King Hom
Git basics with notes
Git basics with notesGit basics with notes
Git basics with notes
Surabhi Gupta
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
Carlo Bernaschina
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
Manish Chakravarty
Git and Github.pptx
Git and Github.pptxGit and Github.pptx
Git and Github.pptx
Hitesh670643
Git slides
Git slidesGit slides
Git slides
Nanyak S
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
Chen-Tien Tsai
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin

Recently uploaded (20)

8. Essential Skills: Application of Number: Ratio
8. Essential Skills: Application of Number: Ratio8. Essential Skills: Application of Number: Ratio
8. Essential Skills: Application of Number: Ratio
leigh441292
Creating Opportunities and Access for Every Student in North Carolina
Creating Opportunities and Access for Every Student in North CarolinaCreating Opportunities and Access for Every Student in North Carolina
Creating Opportunities and Access for Every Student in North Carolina
Mebane Rash
Scattered Radion Survey for QA & QC .pptx
Scattered Radion Survey for QA & QC .pptxScattered Radion Survey for QA & QC .pptx
Scattered Radion Survey for QA & QC .pptx
Dolphin PG College, Chunni Kalan, Fatehgarh Sahib, Mohali
How to Render Dynamic Data using RPC call in Odoo 17 POS
How to Render Dynamic Data using RPC call in Odoo 17 POSHow to Render Dynamic Data using RPC call in Odoo 17 POS
How to Render Dynamic Data using RPC call in Odoo 17 POS
Celine George
Kothari Commission Recommendations And Their Implementation.pptx
Kothari Commission Recommendations And Their Implementation.pptxKothari Commission Recommendations And Their Implementation.pptx
Kothari Commission Recommendations And Their Implementation.pptx
Dr. JN Gorai, PhD
Chapter 4. Environmental Scanning and Industry Analysis.pdf
Chapter 4. Environmental Scanning and Industry Analysis.pdfChapter 4. Environmental Scanning and Industry Analysis.pdf
Chapter 4. Environmental Scanning and Industry Analysis.pdf
Rommel Regala
Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...
Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...
Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...
EduSkills OECD
Q-Factor General Quiz-2nd March 2025, Quiz Club NITW
Q-Factor General Quiz-2nd March 2025, Quiz Club NITWQ-Factor General Quiz-2nd March 2025, Quiz Club NITW
Q-Factor General Quiz-2nd March 2025, Quiz Club NITW
Quiz Club NITW
BREAST FEEDING BENIFITS OF BREAST FEEDING.pptx
BREAST FEEDING BENIFITS OF BREAST FEEDING.pptxBREAST FEEDING BENIFITS OF BREAST FEEDING.pptx
BREAST FEEDING BENIFITS OF BREAST FEEDING.pptx
PRADEEP ABOTHU
Collect information and produce statistics on the trade in goods using Intras...
Collect information and produce statistics on the trade in goods using Intras...Collect information and produce statistics on the trade in goods using Intras...
Collect information and produce statistics on the trade in goods using Intras...
Celine George
UIDP 7Rs and AI 20250319 v4. digital twinspptx
UIDP 7Rs and AI 20250319 v4. digital twinspptxUIDP 7Rs and AI 20250319 v4. digital twinspptx
UIDP 7Rs and AI 20250319 v4. digital twinspptx
home
National Policy On Education-1986 (Objectives And Major Recommendations).pptx
National Policy On Education-1986 (Objectives And Major Recommendations).pptxNational Policy On Education-1986 (Objectives And Major Recommendations).pptx
National Policy On Education-1986 (Objectives And Major Recommendations).pptx
Dr. JN Gorai, PhD
Software Engineering and Traditional Software development models
Software Engineering and Traditional Software development modelsSoftware Engineering and Traditional Software development models
Software Engineering and Traditional Software development models
NitinShelake4
JPO SEP Symposium Mr. Mori - Latest Global Trends
JPO SEP Symposium Mr. Mori - Latest Global TrendsJPO SEP Symposium Mr. Mori - Latest Global Trends
JPO SEP Symposium Mr. Mori - Latest Global Trends
MIPLM
Simple past tense, workshop,, activities
Simple past tense, workshop,, activitiesSimple past tense, workshop,, activities
Simple past tense, workshop,, activities
OlgaLeonorTorresSnch
The Paradox of Perfection - Publecture (EOS VU Amsterdam)
The Paradox of Perfection - Publecture (EOS VU Amsterdam)The Paradox of Perfection - Publecture (EOS VU Amsterdam)
The Paradox of Perfection - Publecture (EOS VU Amsterdam)
Wico Mulder
Design Policy and Strategy in the Expansion of Global Economic Initiatives
Design Policy and Strategy in the Expansion of Global Economic InitiativesDesign Policy and Strategy in the Expansion of Global Economic Initiatives
Design Policy and Strategy in the Expansion of Global Economic Initiatives
MIPLM
How to Configure Tax Cloud in Odoo 17 Accounting
How to Configure Tax Cloud in Odoo 17 AccountingHow to Configure Tax Cloud in Odoo 17 Accounting
How to Configure Tax Cloud in Odoo 17 Accounting
Celine George
Introduction to generative AI for PhD students
Introduction to generative AI for PhD studentsIntroduction to generative AI for PhD students
Introduction to generative AI for PhD students
Ana Canhoto
8. Essential Skills: Application of Number: Ratio
8. Essential Skills: Application of Number: Ratio8. Essential Skills: Application of Number: Ratio
8. Essential Skills: Application of Number: Ratio
leigh441292
Creating Opportunities and Access for Every Student in North Carolina
Creating Opportunities and Access for Every Student in North CarolinaCreating Opportunities and Access for Every Student in North Carolina
Creating Opportunities and Access for Every Student in North Carolina
Mebane Rash
How to Render Dynamic Data using RPC call in Odoo 17 POS
How to Render Dynamic Data using RPC call in Odoo 17 POSHow to Render Dynamic Data using RPC call in Odoo 17 POS
How to Render Dynamic Data using RPC call in Odoo 17 POS
Celine George
Kothari Commission Recommendations And Their Implementation.pptx
Kothari Commission Recommendations And Their Implementation.pptxKothari Commission Recommendations And Their Implementation.pptx
Kothari Commission Recommendations And Their Implementation.pptx
Dr. JN Gorai, PhD
Chapter 4. Environmental Scanning and Industry Analysis.pdf
Chapter 4. Environmental Scanning and Industry Analysis.pdfChapter 4. Environmental Scanning and Industry Analysis.pdf
Chapter 4. Environmental Scanning and Industry Analysis.pdf
Rommel Regala
Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...
Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...
Abigail Sageev presents at the OECD webinar 'Improving skills outcomes throug...
EduSkills OECD
Q-Factor General Quiz-2nd March 2025, Quiz Club NITW
Q-Factor General Quiz-2nd March 2025, Quiz Club NITWQ-Factor General Quiz-2nd March 2025, Quiz Club NITW
Q-Factor General Quiz-2nd March 2025, Quiz Club NITW
Quiz Club NITW
BREAST FEEDING BENIFITS OF BREAST FEEDING.pptx
BREAST FEEDING BENIFITS OF BREAST FEEDING.pptxBREAST FEEDING BENIFITS OF BREAST FEEDING.pptx
BREAST FEEDING BENIFITS OF BREAST FEEDING.pptx
PRADEEP ABOTHU
Collect information and produce statistics on the trade in goods using Intras...
Collect information and produce statistics on the trade in goods using Intras...Collect information and produce statistics on the trade in goods using Intras...
Collect information and produce statistics on the trade in goods using Intras...
Celine George
UIDP 7Rs and AI 20250319 v4. digital twinspptx
UIDP 7Rs and AI 20250319 v4. digital twinspptxUIDP 7Rs and AI 20250319 v4. digital twinspptx
UIDP 7Rs and AI 20250319 v4. digital twinspptx
home
National Policy On Education-1986 (Objectives And Major Recommendations).pptx
National Policy On Education-1986 (Objectives And Major Recommendations).pptxNational Policy On Education-1986 (Objectives And Major Recommendations).pptx
National Policy On Education-1986 (Objectives And Major Recommendations).pptx
Dr. JN Gorai, PhD
Software Engineering and Traditional Software development models
Software Engineering and Traditional Software development modelsSoftware Engineering and Traditional Software development models
Software Engineering and Traditional Software development models
NitinShelake4
JPO SEP Symposium Mr. Mori - Latest Global Trends
JPO SEP Symposium Mr. Mori - Latest Global TrendsJPO SEP Symposium Mr. Mori - Latest Global Trends
JPO SEP Symposium Mr. Mori - Latest Global Trends
MIPLM
Simple past tense, workshop,, activities
Simple past tense, workshop,, activitiesSimple past tense, workshop,, activities
Simple past tense, workshop,, activities
OlgaLeonorTorresSnch
The Paradox of Perfection - Publecture (EOS VU Amsterdam)
The Paradox of Perfection - Publecture (EOS VU Amsterdam)The Paradox of Perfection - Publecture (EOS VU Amsterdam)
The Paradox of Perfection - Publecture (EOS VU Amsterdam)
Wico Mulder
Design Policy and Strategy in the Expansion of Global Economic Initiatives
Design Policy and Strategy in the Expansion of Global Economic InitiativesDesign Policy and Strategy in the Expansion of Global Economic Initiatives
Design Policy and Strategy in the Expansion of Global Economic Initiatives
MIPLM
How to Configure Tax Cloud in Odoo 17 Accounting
How to Configure Tax Cloud in Odoo 17 AccountingHow to Configure Tax Cloud in Odoo 17 Accounting
How to Configure Tax Cloud in Odoo 17 Accounting
Celine George
Introduction to generative AI for PhD students
Introduction to generative AI for PhD studentsIntroduction to generative AI for PhD students
Introduction to generative AI for PhD students
Ana Canhoto

Bsadd training-git

  • 1. A Distributed Version Controlling System BUET Systems Analysis, Design & Development Group Md. Maksud Alam Chowdhury CSE ,BUET mc65799@gmail.com
  • 3. A version controlling system Distributed Most popular software for managing codebases Support for remote collaboration
  • 5. Remove millions of backup folder Smartly merge separate codes Track day to day changes of codes Small changes wont destroy whole project Disk crash or virus wont hamper your codes ever !!!!!!!!!!!!!
  • 9. Branching & Merging (to be discussed widely) Small & Fast Distributed Free & Open Source
  • 11. Standalone version: http://git-scm.com/downloads Portable version: https://code.google.com/p/msysgit/downloa ds/list They both have command line interface .
  • 13. Navigate to your project folder Right Click on Folder-> Git Bash It will open a shell
  • 15. Type git init to initialize a git repo on your project folder. Having existing codes wont cause problem In most cases , you will create a repo where you have your codes. Note that we are in master branch by default We will discuss it later on branching.
  • 17. Lets add some files (not needed in case already have existing codes) Lets create a.cpp , b.txt , c.cpp in the DemoApp Folder. Add some dummy texts on them Current Working Directory DemoApp/ |--a.cpp |--b.txt |--c.cpp
  • 19. So we think our app is stable right now. So we need to commit the files to be preserved Type git add . Type git commit am message describing commit So git will have save current codes as the latest stable code on master branch
  • 21. We can check the status of the current condition of codes by typing git status Every commit is saved uniquely with a number You can switch back to any previous commit any time
  • 24. By Default we are in the master branch which is root . Branches are independent of each other Enough talking !!!!!! Lets create another branch dev which is a development version. We will experiment in the dev branch where as fully stable codes will be in master branch
  • 25. Type git checkout b dev It will create a new branch dev and switch to dev branch The new branch will contain exact copy from where we created it. Any change we do now in the working directory , after commit will go for dev branch
  • 27. Lets change the content of b.txt and create d.txt So we have changed b.txt and added d.txt Now Type git status
  • 29. We now commit the current working directory So Type Again git add . git commit am commit message
  • 31. Lets switch back to the master branch Type git checkout master It will restore the master branch codes Note that b.txt is restored & d.txt is gone So you have two separate version of codes
  • 32. On Master Branch On dev branch
  • 34. So we were in the master branch again We are sure to merge the dev branch into master branch Type git merge dev
  • 36. Surprisingly there is no conflict in b.txt Because until now you are the only person who changed the branch in local workstation
  • 38. We need a central place to synchronize the team members repositories Github , Bitbucket , gitorious , Assembla , repositoryhosting etc. Github only provides public repo If you dont want it to be public go for Bitbucket https://bitbucket.org/account/signup/
  • 44. Similarly as previous slide Type git push origin dev
  • 47. There are several mechanisms [try googling] We will show an easy approach for small teams We will maintain master for ultimate stable version . Each team member will have their own branch
  • 48. After finalizing some features team members will create a temporary branch The temporary branch will be incrementally merged and tested by team captain But there might be conflict in configuration files which might hamper project. [Android menifest.xml , database settings etc ]
  • 49. Do ignore such files while committing Create a .gitignore file and list the directories or file not to be tracked Keep a list of changelog.txt file After merging master do manually change the configurations
  • 50. Conflicts arise when You have changed your local files and committed them in your branch But someone else have also changed the same files in his own branch You want to merge his branch Git will have no way to decide which one to keep and which one to abandon So it keeps both of them in a way you can identify difference.
  • 51. We change our local file b.txt again in master Add , Commit it We pull some previous version of the same file in dev git pull origin dev Pull = fetch + merge Now this will create a conflict
  • 54. Here head is local version Lower part is the fetched version The marker is where things actually started to be different It would not create a conflict if appending was required or creating a new or deleting a file was required But here a complete rewrite is required
  • 55. Git tool command Manually change the conflicting files Add, Commit , Push Dont Pull directly At first fetch (git fetch origin dev) See Whether any difference (git diff origin/dev) The decide to merge
  • 56. If you already have a repo on bitbucket or github like the one we created Just type git clone <http_link_of_project> So you dont need to bother about backup or disk lost
  • 59. git init git add . git commit am <your commit message> git status git checkout b <New_Branch_Name> git checkout <Branch_Name> git merge <Branch_Name> git remote add <Name_For_Server> <Link_Of_Your_Project> git push <Name_For_Server> <Branch_To_Push> git pull <Name_For_Server> <Branch_To_Pull> git fetch <Name_For_Server> <Branch_To_Fetch> git diff <Branch_To_Compare_With_Current_Branch>
  • 62. Please Email Any Question At: mc65799@gmail.com