Git Fundamentals

Version Control System

It is a system for storing and versioning of files. Storing revisions of files,directories and metadata of each version which defines Who make the changes, When file checked in and Why changes done .

Types of Version Control System

Centralized : Code is hosted in a centralized repository where all contributors are connected together. In this user must need to connect to internet or intranet to perform any action on files .
Eg :- VSS, SVN, TFS, Perforce, IBM Rational ClearCase

Distributed : Repository can be hosted either on cloud or local data center and contributors can clone it on their local environment. In this local environment acts as a repository and all commits are first make into it and then sync up the same with Master or Main repository .
Eg :- Git, Bitbucket,Mercurial , Bitkeeper

What is Git ?

Git is Distributed Version Control System used in Software development with emphasis on speed, data integrity, and  support for distributed, non-linear workflows .
For More Info :- https://git-scm.com/book/en/v2
  • Git Configuration:
    • System level :- Git is configured for all the users in the system. Command is git config –system user.name “xyz”.
    • Global level :- Git is configured for only the current user and all its projects. Command is git config — global user.name “xyz”.
    • Local level :- Git is configured for only one project for the current user. Command is git config —local user.name “xyz”.
  • .gitignore file is used for ignoring files in each project. We have to specify name of those files and folders . This file recommended to be placed at root folder of repository .
  • File Life Cycle :
    • Untracked :- New files and folders added to the repository.
    • Tracked :- Existing files in Git VCS and have been modified.
  • Basic Commands :
    • git add :- This will add the files to be tracked by git.
    • git commit -m “ <commit message>” :- Command will commit changes to local repository (“-m” means message).
    • git pull :- Command will pull new commits from master or main repository to local repository .
    • git push :- Command will push commits from local repository to master or targeted repository .
  • Branching : It is a working copy of your application code. By Default git create Master branch and enable us to create multiple copies of same .
    • git branch <branch name>:- Create new branch
    • git checkout <branch name>:- Switch branches
    • git branch -D <branch name>:- Delete branch
    • git push origin <branch name>:- Update master repository
    • git branch :- List down all available branch of your repository
  • Origin : This keyword is used as alias to identify URL of target repository .
  • Tagging : Checkpoint on commits and helpful in deployment process .
    • git tag <tag name> :- Create new tag
    • git tag :- List down all tags for repository
    • git push origin <tag name> :- Push tag to Master repository
    • git tag -D <tag name> Delete tag

Helpful Links :-

Git official website: https://git-scm.com/
Git About: https://git-scm.com/about
Git Cheat sheet: https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf
Git visual cheat sheet: http://ndpsoftware.com/git-cheatsheet.html
Pro Git book: https://git-scm.com/book/en/v2
Git Videos: https://git-scm.com/videos
External Links: https://git-scm.com/doc/ext
Git Community: https://git-scm.com/community
https://try.github.io/
https://www.tutorialspoint.com/git/index.htm
http://www.marinamele.com/2014/07/git-tutorial-create-a-repository-commit-git-branches-and-bitbucket.html
https://www.atlassian.com/git/tutorials
https://git-scm.com/book/en/v2
https://git-scm.com/doc
https://git-scm.com/about

Git Cheat Sheets:
https://git-scm.com/docs
https://ndpsoftware.com/git-cheatsheet.html
https://www.git-tower.com/blog/git-cheat-sheet/
https://itsfoss.com/basic-git-commands-cheat-sheet/
https://www.keycdn.com/blog/git-cheat-sheet
https://www.codementor.io/@mattgoldspink/git-cheatsheet-du1088tr0

Leave a Reply