SlideShare a Scribd company logo
VERSION CONTROL
SYSTEM, GIT, BITBUCKET
MD. MAIN UDDIN RONY
Software Engineer, Infolytx, Inc.
IDEA BEHIND VERSION CONTROL
❑ Different releases of a product
❑ Variations for different platforms
• Hardware and software
❑ Versions within a development cycle
• Test release with debugging code
• Alpha, beta of final release
❑ Each time we may edit a program on recommendation or
fixing bugs
VERSION CONTROL
❑ Version control is a system that records changes to a file
or set of files over time so that you can recall specific
versions later.
❑ In particular, allows
• old versions to be recovered
• multiple versions to exist simultaneously
WHY USE VERSION CONTROL?
❑ Because everyone does
• A basic software development tool
❑ Because it is useful
• We will want old/multiple versions
• Without version control, can’t recreate project history
❑ Because we require it
• For our own good
• It allows you to revert files back to a previous state
• If we screw things up or lose files, we can easily recover
VARIOUS VERSION CONTROL
SYSTEMS
LOCAL VERSION CONTROL SYSTEMS
CENTRALIZED VERSION CONTROL
SYSTEM
DISTRIBUTED VERSION CONTROL
SYSTEMS
GIT : WHAT, WHY?
❑ Distributed revision control system
❑ Originally developed by Linus Torvalds for the
development of the Linux Kernel in 2005
❑ Focus on speed and efficiency
❑ Guard against data corruption, never lose data without
intervention
❑ Strong support for non-linear development (thousands of
parallel branches)
❑ Able to handle large projects like the Linux kernel
efficiently(speed and data size)
❑ Simple design
GIT OVER OTHER VCS
❑ The major difference between Git and any other VCS is the
way Git thinks about its data.
❑ Conceptually, most other systems store information as a list of
file-based changes.
❑ They think of the information they keep as a set of files and the
changes made to each file over time.
❑ But, Git thinks about its data more like a stream of snapshots.
❑ Every time we commit, or save the state of our project in Git, it
basically takes a picture of what all our files look like at that
moment and stores a reference to that snapshot.
❑ To be efficient, if files have not changed, Git doesn’t store the
file again, just a link to the previous identical file it has already
stored.
GIT OVER OTHER VCS (CONTD.)
Other VCS
GIT
GIT OBJECT MODEL
A “blob” is content under version control (a file)
(Binary Large Object)
GIT OBJECT MODEL (CONTD.)
We can have trees of blobs which means directories of files.
GIT OBJECT MODEL (CONTD.)
A “commit” is a tree of blobs
(a set of changes)
GIT OBJECT MODEL (CONTD.)
Most commits modify (or merge) earlier commits.
GIT OBJECT MODEL (CONTD.)
We can “tag” an interesting commit
GIT OBJECT MODEL (CONTD.)
A graph of commits may belong to a branch.
GIT OBJECT MODEL (CONTD.)
“HEAD” is the current branch
GIT OBJECT MODEL (CONTD.)
Let’s focus on commits and branches
GIT BASICS
CREATE A GIT REPO
❑ If we’re starting to track an existing project in Git, we need to
go to the project’s directory and type ‘git init’
❑ This creates a new subdirectory named .git that contains all of
your necessary repository files – a Git repository skeleton
CLONING AN EXISTING REPOSITORY
For example, if you want to clone the Git linkable library
called libgit2, you can do so like this:
If you want to clone the repository into a directory named
something other than “libgit2”, you can specify that as the
next command-line option:
git clone [url]]
TO TELL GIT TO “STAGE” CHANGES
COMMIT OUR CHANGES
THE FLOW IS
LIFECYCLE OF THE STATUS OF FILES
IN GIT
CHECKING THE STATUS OF FILES
Suppose we add a new file in our project (a README file)
TRACKING NEW FILES
Then run again status checking command
STAGING MODIFIED FILES
Let’s change a file that was already tracked. If we change a
previously tracked file called “CONTRIBUTING.md” and then
run our git status command again, we get something that
looks like this:
STAGE THE MODIFIED FILE
Let’s run git add now to stage the “CONTRIBUTING.md” file,
and then run git status again:
COLLABORATING
BASIC BRANCHING
AND MERGING
A simple Commit History
Creating a new branch pointer
The iss53 branch has moved forward with our work
Hotfix branch based on master
master is fast-forwarded to hotfix after merging hotfix with
master
Work continues on iss53
Three snapshots used in a typical merge
A merge commit
MERGE CONFLICT
CONFLICT & RESOLVE
BASIC GIT
COMMANDS
Git task Notes Git Commands
Tell Git who you are Configure the author
name and email
address to be used
with your commits.
Note that Git strips
some characters (for
example trailing
periods)
from user.name.
git config --global
user.name "Sam
Smith“
git config --
global user.email
sam@example.com
Create a new local
Repository
git init
Checkout a repository Create a working copy
of a local repository:
git clone
/path/to/repository
For a remote server,
use:
git clone
username@host:/path/
to/repository
Git Task Notes Git Commands
Add Files Add one or more files to staging
(index):
git add <filename>
git add *
Commit Commit changes to head (but not
yet to the remote repository):
git commit -m "Commit
message"
Commit any files you've added
with git add, and also commit any
files you've changed since then:
git commit -a
Push Send changes to the master
branch of your remote repository:
git push origin master
Status List the files you've changed and
those you still need to add or
commit:
git status
Git Task Ntes Git Commands
Connect to a remote
repository
If you haven't connected your local
repository to a remote server, add the
server to be able to push to it:
git remote add origin <server>
List all currently configured remote
repositories:
List all currently configured
remote repositories:
Branches Create a new branch and switch to it: git checkout -b <branchname>
Switch from one branch to another: git checkout <branchname>
List all the branches in your repo, and
also tell you what branch you're
currently in:
git branch
Delete the feature branch: git branch -d <branchname>
Push the branch to your remote
repository, so others can use it:
git push origin <branchname>
Push all branches to your remote
repository:
git push --all origin
Delete a branch on your remote
repository:
git push origin :<branchname>
Git Task Notes Git Commands
Update from the remote
repository
Fetch and merge changes on the remote
server to your working directory:
git pull
To merge a different branch into your active
branch:
git merge <branchname>
View all the merge conflicts:
View the conflicts against the base file:
Preview changes, before merging:
git diff
git diff --base <filename>
git diff <sourcebranch>
<targetbranch>
After you have manually resolved any
conflicts, you mark the changed file:
git add <filename>
Undo Local changes If you mess up, you can replace the
changes in your working tree with the last
content in head:
Changes already added to the index, as
well as new files, will be kept.
git checkout -- <filename>
Instead, to drop all your local changes and
commits, fetch the latest history from the
server and point your local master branch at
it, do this:
git fetch origin
git reset --hard origin/master
BITBUCKET
WHAT IS IT?
❑ BitBucket is a web-based code server and also a great
management tool for software projects.
❑ On 29 September 2010, Bitbucket was acquired by VC-
funded Atlassian. Initially, Bitbucket only offered hosting
support for Mercurial projects. On 3 October 2011, Bitbucket
officially announced support for Git hosting.
WHY SHOULD WE USE IT?
❑ Bitbucket is completely free if you have a .edu email
address.
❑ Gives any one any number of repositories, free for only 5
users, otherwise see the payment on their site.
❑ Site: https://bitbucket.org
CREATING REPOSITORY
21 June 2015
REPOSITORY PAGE
oNotice these buttons in the right.
oSimple design that gives you only what you want from a code hosting,
no noisy design.
oNotice the menu ( overview, source, commits, pull requests, issues,
wiki, downloads)
▪ This menu has the most important functionality that bitbucket
provide for us.
▪ In the right of the menu is the settings of repository
21 June 2015
Bitbucket integration with
Eclipse
Here is a video demonstrating how Bitbucket can be integrated
with Eclipse:
REFERENCE
Many context, pictures are borrowed from
https://git-scm.com/
21 June 2015
ANY QUESTION?
THANK YOU

More Related Content

What's hot

Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
Arthur Shvetsov
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
Shawn Doyle
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
KMS Technology
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
Prem Aseem Jain
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
Aderemi Dadepo
 
Git
GitGit
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
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 hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
Luigi De Russis
 
Git presentation
Git presentationGit presentation
Git presentation
Sai Kumar Satapathy
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Git training
Git trainingGit training
Git training
adm_exoplatform
 

What's hot (20)

Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
 
Git 101
Git 101Git 101
Git 101
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Git
GitGit
Git
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
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 ...
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Git introduction
Git introductionGit introduction
Git introduction
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Git training
Git trainingGit training
Git training
 

Similar to Version controll.pptx

Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 
Git&GitHub.pptx
Git&GitHub.pptxGit&GitHub.pptx
Git&GitHub.pptx
KondiVenkatesh1
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
Mithilesh Singh
 
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
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
Prakash Dantuluri
 
introduction in version control system
introduction in version control systemintroduction in version control system
introduction in version control system
Biga Gaber
 
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
Introduction to git & GitHub
Introduction to git & GitHubIntroduction to git & GitHub
Introduction to git & GitHub
Poornachandrakashi
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
Nyros Technologies
 
Git and Github - A primer
Git and Github - A primerGit and Github - A primer
Git and Github - A primer
Suryakumar Sudar
 
Git slides
Git slidesGit slides
Git slides
Nanyak S
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
Himanshu Agrawal
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
Soumen Debgupta
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
PRIYATHAMDARISI
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
PravallikaTammisetty
 
Git and Github.pptx
Git and Github.pptxGit and Github.pptx
Git and Github.pptx
Hitesh670643
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma
 

Similar to Version controll.pptx (20)

Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
Learning git
Learning gitLearning git
Learning git
 
Git&GitHub.pptx
Git&GitHub.pptxGit&GitHub.pptx
Git&GitHub.pptx
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
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
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
introduction in version control system
introduction in version control systemintroduction in version control system
introduction in version control system
 
Git for developers
Git for developersGit for developers
Git for developers
 
Introduction to git & GitHub
Introduction to git & GitHubIntroduction to git & GitHub
Introduction to git & GitHub
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Git and Github - A primer
Git and Github - A primerGit and Github - A primer
Git and Github - A primer
 
Git slides
Git slidesGit slides
Git slides
 
Extra bit with git
Extra bit with gitExtra bit with git
Extra bit with git
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 
Git and Github.pptx
Git and Github.pptxGit and Github.pptx
Git and Github.pptx
 
Git hub
Git hubGit hub
Git hub
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 

Version controll.pptx

  • 1. VERSION CONTROL SYSTEM, GIT, BITBUCKET MD. MAIN UDDIN RONY Software Engineer, Infolytx, Inc.
  • 2. IDEA BEHIND VERSION CONTROL ❑ Different releases of a product ❑ Variations for different platforms • Hardware and software ❑ Versions within a development cycle • Test release with debugging code • Alpha, beta of final release ❑ Each time we may edit a program on recommendation or fixing bugs
  • 3. VERSION CONTROL ❑ Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. ❑ In particular, allows • old versions to be recovered • multiple versions to exist simultaneously
  • 4. WHY USE VERSION CONTROL? ❑ Because everyone does • A basic software development tool ❑ Because it is useful • We will want old/multiple versions • Without version control, can’t recreate project history ❑ Because we require it • For our own good • It allows you to revert files back to a previous state • If we screw things up or lose files, we can easily recover
  • 9. GIT : WHAT, WHY? ❑ Distributed revision control system ❑ Originally developed by Linus Torvalds for the development of the Linux Kernel in 2005 ❑ Focus on speed and efficiency ❑ Guard against data corruption, never lose data without intervention ❑ Strong support for non-linear development (thousands of parallel branches) ❑ Able to handle large projects like the Linux kernel efficiently(speed and data size) ❑ Simple design
  • 10. GIT OVER OTHER VCS ❑ The major difference between Git and any other VCS is the way Git thinks about its data. ❑ Conceptually, most other systems store information as a list of file-based changes. ❑ They think of the information they keep as a set of files and the changes made to each file over time. ❑ But, Git thinks about its data more like a stream of snapshots. ❑ Every time we commit, or save the state of our project in Git, it basically takes a picture of what all our files look like at that moment and stores a reference to that snapshot. ❑ To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored.
  • 11. GIT OVER OTHER VCS (CONTD.) Other VCS GIT
  • 12. GIT OBJECT MODEL A “blob” is content under version control (a file) (Binary Large Object)
  • 13. GIT OBJECT MODEL (CONTD.) We can have trees of blobs which means directories of files.
  • 14. GIT OBJECT MODEL (CONTD.) A “commit” is a tree of blobs (a set of changes)
  • 15. GIT OBJECT MODEL (CONTD.) Most commits modify (or merge) earlier commits.
  • 16. GIT OBJECT MODEL (CONTD.) We can “tag” an interesting commit
  • 17. GIT OBJECT MODEL (CONTD.) A graph of commits may belong to a branch.
  • 18. GIT OBJECT MODEL (CONTD.) “HEAD” is the current branch
  • 19. GIT OBJECT MODEL (CONTD.) Let’s focus on commits and branches
  • 21. CREATE A GIT REPO ❑ If we’re starting to track an existing project in Git, we need to go to the project’s directory and type ‘git init’ ❑ This creates a new subdirectory named .git that contains all of your necessary repository files – a Git repository skeleton
  • 22. CLONING AN EXISTING REPOSITORY For example, if you want to clone the Git linkable library called libgit2, you can do so like this: If you want to clone the repository into a directory named something other than “libgit2”, you can specify that as the next command-line option: git clone [url]]
  • 23. TO TELL GIT TO “STAGE” CHANGES
  • 26. LIFECYCLE OF THE STATUS OF FILES IN GIT
  • 27. CHECKING THE STATUS OF FILES Suppose we add a new file in our project (a README file)
  • 28. TRACKING NEW FILES Then run again status checking command
  • 29. STAGING MODIFIED FILES Let’s change a file that was already tracked. If we change a previously tracked file called “CONTRIBUTING.md” and then run our git status command again, we get something that looks like this:
  • 30. STAGE THE MODIFIED FILE Let’s run git add now to stage the “CONTRIBUTING.md” file, and then run git status again:
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 42. A simple Commit History
  • 43. Creating a new branch pointer
  • 44. The iss53 branch has moved forward with our work
  • 45. Hotfix branch based on master
  • 46. master is fast-forwarded to hotfix after merging hotfix with master
  • 48. Three snapshots used in a typical merge
  • 53. Git task Notes Git Commands Tell Git who you are Configure the author name and email address to be used with your commits. Note that Git strips some characters (for example trailing periods) from user.name. git config --global user.name "Sam Smith“ git config -- global user.email sam@example.com Create a new local Repository git init Checkout a repository Create a working copy of a local repository: git clone /path/to/repository For a remote server, use: git clone username@host:/path/ to/repository
  • 54. Git Task Notes Git Commands Add Files Add one or more files to staging (index): git add <filename> git add * Commit Commit changes to head (but not yet to the remote repository): git commit -m "Commit message" Commit any files you've added with git add, and also commit any files you've changed since then: git commit -a Push Send changes to the master branch of your remote repository: git push origin master Status List the files you've changed and those you still need to add or commit: git status
  • 55. Git Task Ntes Git Commands Connect to a remote repository If you haven't connected your local repository to a remote server, add the server to be able to push to it: git remote add origin <server> List all currently configured remote repositories: List all currently configured remote repositories: Branches Create a new branch and switch to it: git checkout -b <branchname> Switch from one branch to another: git checkout <branchname> List all the branches in your repo, and also tell you what branch you're currently in: git branch Delete the feature branch: git branch -d <branchname> Push the branch to your remote repository, so others can use it: git push origin <branchname> Push all branches to your remote repository: git push --all origin Delete a branch on your remote repository: git push origin :<branchname>
  • 56. Git Task Notes Git Commands Update from the remote repository Fetch and merge changes on the remote server to your working directory: git pull To merge a different branch into your active branch: git merge <branchname> View all the merge conflicts: View the conflicts against the base file: Preview changes, before merging: git diff git diff --base <filename> git diff <sourcebranch> <targetbranch> After you have manually resolved any conflicts, you mark the changed file: git add <filename> Undo Local changes If you mess up, you can replace the changes in your working tree with the last content in head: Changes already added to the index, as well as new files, will be kept. git checkout -- <filename> Instead, to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it, do this: git fetch origin git reset --hard origin/master
  • 58. WHAT IS IT? ❑ BitBucket is a web-based code server and also a great management tool for software projects. ❑ On 29 September 2010, Bitbucket was acquired by VC- funded Atlassian. Initially, Bitbucket only offered hosting support for Mercurial projects. On 3 October 2011, Bitbucket officially announced support for Git hosting.
  • 59. WHY SHOULD WE USE IT? ❑ Bitbucket is completely free if you have a .edu email address. ❑ Gives any one any number of repositories, free for only 5 users, otherwise see the payment on their site. ❑ Site: https://bitbucket.org
  • 61. REPOSITORY PAGE oNotice these buttons in the right. oSimple design that gives you only what you want from a code hosting, no noisy design. oNotice the menu ( overview, source, commits, pull requests, issues, wiki, downloads) ▪ This menu has the most important functionality that bitbucket provide for us. ▪ In the right of the menu is the settings of repository 21 June 2015
  • 62. Bitbucket integration with Eclipse Here is a video demonstrating how Bitbucket can be integrated with Eclipse:
  • 63. REFERENCE Many context, pictures are borrowed from https://git-scm.com/ 21 June 2015