Tuesday, March 15, 2016

Learning GIT

Learning GIT
- GIT is a Distributed Version Control System.
- Version Control is a System that records the changes to a file or set of files overtime
   so that you can recall specific version later.
- GIT Stores the data as meta-data, that's the reason GIT does not occupy alot of space.
- GIT Repository has .git folder, it has all the content info such as tags, branches, version histories etc
- Distributed VCS(Version Control System) means every developer who checks out the code to
   his/her local will get complete history about the project from the Remote Project Repository.

Advantages of GIT:
- Being Distributed VCS(Version Control System) - It means every developer who checkout
   the code will have the complete history of the Project.
- Once Code is Checked out, It becomes developer local copy - also called as local repository.
- Once you have the Local Repository, even if you don't have internet connection, you can still work
  on the coding, adding files to the local repository and continue your work.
- Once you connect to Network, then you can push all your commits to the Remote Repository.
- Note : Please remember to pull the remote changes done by other developers before pushing your
  changes. (Or) Do a Fetch and Pull - Incase if there is a possibility if your team members might
  work on the same files that you are working on.
- GIT is faster compared with any other SCM Tools like Clearcase, SVN etc.,

GIT Terminology:
- Repository  = Location where the files are stored..
- .git folder    = hidden folder in which all the meta-data of the repository is stored.
- init              = Initiation of a repository.
- create         = To Create a Repository, This Repository creation means initiating the repository.
- clone          = To Clone existing remote repository into your local workspace
- local repo   = The Repository which is on your/developers machines.
- remote repo= The Repository that is available on Central GIT Server or GitHub or GitLab- which
                         all developers have access and they can collaborate all their code/files.
- bare repo    = The Repo on the Remote Central  GIT Server or github or gitlab is called bare repo
                         and it will be shared repostory, because all the developers will be able to share their
                         code with others, Note: Bare Repo does not have Working directory.
- non-bare repo = Non bare Repo is something on each developer machine, it has working directory,
                            Working directory is where you can add, edit, delete the files/code and check in to
                            your local repo.
GIT Commands:
git init                          = To initiate a repository.
git init --bare --shared = To initiate a Bare and Shared Repository.
git status                      = To know the status of the files(whether staged, committed etc.,)
git log                          = To see all the logs of commits information.
git add                         = To add the unversioned files to the Staging Index.
git commit                  = Once files added to staging index, git commit will commit the files to the
                                       local repository and this will make your working directory clean for adding                                          next files, changes.
git push                      = push command is used to push your local repo to the remote repo, so the
                                      code/ files  will be available for all other developers in your team who has                                             access to the remote repo.


1 comment:

  1. This comment has been removed by a blog administrator.


Note: Only a member of this blog may post a comment.