Git and Gitlab

Version control system

What we'll cover:

  1. Concept of Git.
  2. What is GitLab.
  3. How to Use Git.

What is this?

as a kind of database. It lets you save a snapshot of the complete project at any point of time.

  • Git is free and open source distributed system with the emphasis on speed and data integrity.
  • Developed as a repository system for both local and remote changes.

What is Git

Git in Industry

  • Git tracks the content rather than the files
  • Branches are lightweight, and merging is a simple process
  • Allows for a more streamlined offline development process
  • Repositories are smaller in size and are stored in a single .git directory
  • Workflows
  • Staging Area

Why Git is Better?

GitHub is a code hosting platform for collaboration and version control.

GitHub lets you (and others) work together on projects.

It is web portal and cloud hosting service for your Git repositories.

What is GitHub?

  • Git can be downloaded for Windows, Linux or Mac.
  • GUI clients are available for Git.

How to Use Git?

  • git config --global user.name "Amro".
  • git config --global user.email amromaroof2@gmail.com.

Tell Git who you are?

Configure the author name and email address to be used with your commits.

Git Commands

  • git init : Create a new local repository
  • git add <filename> : Add files ,Add one or more files to staging (index)
  • git commit -m "Commit message" : Commit changes to head (but not yet to the remote repository)
  • git status : List the files you've changed and those you still need to add or commit:

git init:

  • Tom and Jerry are coding partners
  • Tom implements new feature as a branch
  • Tom makes a pull request to Jerry
  • Jerry reviews Tom’s code
  • After review, Jerry merges Tom’s code to master

Feature Branch Workflow:

Branches:

  • git checkout -b <branchname> : Create a new branch and switch to it
  • git checkout <branchname> : Switch from one branch to another
  • git branch : List all the branches in your repo, and also tell you what branch you're currently in
  • git branch -d <branchname> : Delete the feature branch

Branch

  • git push origin <branchname> : Push the branch to your remote repository
  • git pull : Fetch and merge changes on the remote server to your working directory
  • git merge <branchname> : To merge a different branch into your active branch

Branch

A web interface for Git

Provides additional features on top of a Git repository

Allows for access to the repository from a web browser

Support for attachments and code snippets

Gitlab

What is Gitlab

  • Integrates seamlessly with Git
  • Allows for a detailed viewing and documentation of the project


Written By:
Amro Maroof

No Comments

Add a Comment

Fields marked * are required.