What is GIT?

Git is a version control system.

Smile2gether
2 min readJan 23, 2020

--

Usually, git used to track your source code change in the development process. You can save your current version of source code, or even go back to the last version you need.

Git can be used for individual projects as offline or even share the same code in the company.

To make it clear, here is a git structure.

Git can be shared online like on GITHUB, GitLab, or Bitbucket. Also can save your own change offline with 3 stages

  1. Working directory
  2. Staging
  3. Local Repository: this is where you can manage your version.

You also need to understand git branch and branch strategy which mostly used in tech companies. Most company use master branch as the main branch that keeps the latest running version, develop branch to keep the working version with new features.

Basic commands you should know.

# initialise a git repository
git init
# copy repository from remote source
git clone <<__CLONE_GIT_URL__>>
# add change file to staging
git add <<__FILE_NAME__>>
# add all change to staging
git add .
# save entire change with comment
git commit -m "__COMMENT__"
git commit -m "Initial commit"
# see current file changes
git status
# view recently commit
git logs
# list all branchs
git branch
# checkout to branch
git checkout <<__BRANCH_NAME__>>
git checkout master
# create new branch
git checkout -b <<__NEW_BRANCH_NAME__>>
git checkout -b feature
# merge branch to your current branch
git merge <<__BRANCH_NAME_YOU_WANT_TO_MERGE__>>
# merge feature branch to develop
git checkout develop
git merge feature

If you want to know more about git command.

I hope this helps you understand and use it to make your coding life better. :)

--

--