Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Before and After                          Without version control system                  Day 1                         Da...
High level structure           Centralized                                Distributed                                     ...
Features      Distributed development.      Every Developer has full copy.      Most operation are local, so its fast. ...
Create repository                          Repository created              MyProject                 repo $ git init
Clone a repository                                                            Remote                                      ...
Adding files/directories (modified)         Working                   Staging        directory                    area    ...
Committing changes                                       Staging             Local Why commit is important :              ...
Reset changes         Working            Staging          Local        directory             area            repo         ...
Key points      Git add :      – To add new files.      – To add files to staging area (shortcut: commit -a).      Git r...
Status of untracked/modified files         Working                  Staging             Local        directory            ...
Remote repository                                                           Remote                                        ...
Key points      Git clone :      – Creates a new repository by copying everything from an        existing repository.   ...
Pushing changes    Working     Staging                 Local                  Remote   directory     area                 ...
Pulling changes    Working     Staging                 Local                  Remote   directory     area                 ...
Fetching changes    Working     Staging                   Local                    Remote   directory     area            ...
Key points      Git pull :      – Internally it is git fetch + git merge.      Git fetch :      – Gets all the changes b...
Create branch                              You are here                       B1                                          ...
Switch between branch                       B1                                               Master                       ...
Merge branch                    B1                             You are here                                            Mas...
Tagging                                         Master                               Tagged a commit $ git tag <commit has...
Powered by             Prathamesh Nevagi
Upcoming SlideShare
Loading in …5
×

Getting started with GIT

422 views

Published on

Getting started with GIT. Basics of how to use GIT version control system.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Getting started with GIT

  1. 1. Before and After Without version control system Day 1 Day 2 Day 3 Project Project Project Directory Directory Directory bytes bytes bytes bytes bytes bytes bytes With version control system Day 1 Day 2 Day 3 Project Project Project Directory Directory Directory bytes bytes bytes bytes bytes bytes bytes
  2. 2. High level structure Centralized Distributed Team Team Lead Lead Sr.Dev Sr.Dev Central Repository Sr.Dev Sr.Dev Jr.Dev Jr.Dev Jr.Dev Jr.Dev Jr.Dev Jr.Dev Jr.Dev Jr.Dev
  3. 3. Features  Distributed development.  Every Developer has full copy.  Most operation are local, so its fast.  Strong support for non-linear development.
  4. 4. Create repository Repository created MyProject repo $ git init
  5. 5. Clone a repository Remote repo Local repo Cloning complete repository to local $ git clone <url>
  6. 6. Adding files/directories (modified) Working Staging directory area stage files $ git add <file/dir name>
  7. 7. Committing changes Staging Local Why commit is important : area repo  Each commit gets an SHA1 hash key.  What you put in is what you get out. commits $ git commit -am “<commit message>”
  8. 8. Reset changes Working Staging Local directory area repo Add – for modified Or new files Remove for staging area $ git reset $ git reset --hard
  9. 9. Key points  Git add : – To add new files. – To add files to staging area (shortcut: commit -a).  Git reset : – Clear staging area. – Clear local changes with “--hard” option.
  10. 10. Status of untracked/modified files Working Staging Local directory area repo stage files commits $ git status
  11. 11. Remote repository Remote repo Local repo Copy url name only $ git remote add <repo_name> <url>
  12. 12. Key points  Git clone : – Creates a new repository by copying everything from an existing repository.  Git remote add : – Creates an entry with the name of a particular url in git config file.
  13. 13. Pushing changes Working Staging Local Remote directory area repo repo Push changes $ git push <repo_name> <branch_name>
  14. 14. Pulling changes Working Staging Local Remote directory area repo repo Pull changes $ git pull <repo_name> <branch_name>
  15. 15. Fetching changes Working Staging Local Remote directory area repo repo Fetch changes Re ba se $ git fetch <repo_name> <branch_name> $ git rebase <repo_name>/<branch_name>
  16. 16. Key points  Git pull : – Internally it is git fetch + git merge.  Git fetch : – Gets all the changes but does not apply to working copy.  Git rebase : – Changes the commit history to match remote repo and applies changes to working copy.  There are two ways to integrate changes merge and rebase respectively.
  17. 17. Create branch You are here B1 Master $ git branch <branch_name>
  18. 18. Switch between branch B1 Master B2 You are here $ git checkout <branch_name>
  19. 19. Merge branch B1 You are here Master $ git merge <branch_name>
  20. 20. Tagging Master Tagged a commit $ git tag <commit hash key>
  21. 21. Powered by Prathamesh Nevagi

×