Created By 
 Varun Maliwal / @vroom_
            Software Engineer @ Capital One
          
Ever make a few changes and now nothing works? Git is here to save the day!
Git allows you to revisit the entire history of your project and easily rollback to previous revisions.
.git subdirectory is called as repository
.git can be opened and modified in text editor
              
              $ mkdir [project-name]
              $ cd [project-name]
              $ git init
              
            
            
            
              
                    git-example/
                      .git/
                        config
                        description
                        HEAD
                        hooks/
                        info/
                        objects/
                        refs/
              
            
          Cloning creates your own personal copy of a repository.
              
        $ git clone [git-url]
        $ git clone https://github.com/vmaliwal/git-collab.git
              
            
          A commit object creats a snapshot of files in your project at a given point in time. It's a sort of bookmark that you can revisit at a later point in time.
Git is DAG that holds snapshots of commit objects as nodes
Commit object is uniquely identified by a 40-character SHA1 hash
Create a new file or modify existing
              
            $ echo "Introduction to Git" > README
              
            
            
              
            $ git status
            # On branch master
            #
            # Initial commit
            #
            # Untracked files:
            #   (use "git add [file]..." 
            # to include in what will be committed)
            #
            # README
              
            
            
          
              
                $ git add [file-name]
                $ git commit -m "Initial commit"
              
            
            
            Also
              
                $ git add .
                $ git commit -a -m "Initial commit"
              
            
          
              
               HEAD -->  * fe1e7c5 Updated image 1
                         * 234954a Added images
                         * dce32e6 Initial commit 
              
            
            HEAD points to commit (3) on master branch
              
                # creates a new branch
                $ git branch [new-branch-name] 
                # move HEAD to point to new branch
                $ git checkout [new-branch-name] 
              
            
            
              
                $ git checkout -b [new-branch-name]
              
            
          
              $ git merge [branch-name]
            
          
              
                COMMIT 1 --> * cd9e5f2 updated share url
                COMMIT 2 --> * b7df983 added agenda
                             |\  
                COMMIT 3 --> | * 6936cfc added some definitions
                COMMIT 4 --> * | 64d856e fixed typos 
              
            
          
              
                COMMIT 1 --> * cd9e5f2 updated share url
                COMMIT 2 --> * b7df983 added agenda
                             |\  
                COMMIT 3 --> | * 6936cfc added some definitions
                COMMIT 4 --> * | 64d856e fixed typos 
                             |/  
                COMMIT 5 --> * 3bc4271 merged branch
              
            
            (5) contains changes between (3) and (4) merged together
 
           
          
              
      $ git clone [git-remote-repo-url].git
              
            
            As name suggests clone command can be used to clone any remote repository
              
      $ git remote add origin [git-remote-repo-url].git
      $ git push origin master
              
            
            origin is a remote repository reference that git uses
              
      $ git pull [remote-repo-reference] [remote-branch-name]
      $ git pull origin master
              
            
          
              
      $ git push [remote-repo-reference] [remote-branch-name]
      $ git push origin master
              
            
          While pulling or merging a branch merge conflicts can occur due to conflicting changes
 
          
              
                $ git checkout -b develop
              
            
           
          
              
              $ git branch
              * develop
                master 
              
            
          
              $ git checkout master
            
             
          
              
  $ git merge develop
  Auto-merging app.js
  CONFLICT (content): Merge conflict in app.js
  Automatic merge failed; fix conflicts and then commit the result.
              
            
           
          