This part of the GIT tutorial includes the GIT Cheat Sheet. In this part, you will learn various aspects of GIT that are possibly asked in interviews. Also, you will have a chance to understand the most important GIT Terminologies.
9.7 K Views
GIT User Handbook
This GIT cheat sheet is designed for the one who has interested and learning about the file management and using GIT as a tool, then this sheet will be a handy reference sheet. Don’t worry if you are a beginner and have no idea about how GIT works, this GIT cheat sheet will give you a quick reference of the basics that you must know to get started.
What is GIT?
GIT is a tool in DevOps which is used as version-control system for tracking changes in system files and coordinating work on those files among a group of people. In the software development field, GIT is used in source-code management and track the changes in any files.
GIT is a distributed version control and source code management system with an emphasis on speed.
It is repository which is used to manage projects, set of files as they change over the time.
Using GIT every code change or commit you get latest development code for the project.
Watch this Git Tutorial Video
It shows the process flow with components used to perform certain tasks
Plan: It can be created or deleted by itself based on the updates in the source repository
Code: The statements written to perform a task in a repository
Shared repository: Repository which is shared among several members in order to perform the task
Continuous integration: It helps in updating the repository with the change made in the code and provides integration with the changes made time to time
Build: It is used to manually build products and dependencies to GIT
Configuration Management: It is a process of tracking and controlling changes in a system
Deploy: Pushing the code to the remote server
It is the management of changes to the code, documents, programs, large sites and other info.
The changes are termed as versions.
Version control system is used (VCS)
The functions are:
Allows developers to work simultaneously.
Does not allow overwriting each other’s changes.
Maintains a history of every version.
There are 2 types of VCS – centralized and distributed.
GIT falls under distributed
GIT and GITHUB:
It is a VCS that supports distributed nonlinear workflows by providing data assurance for developing quality software.
Distributed – distributed development of code
compatible – with existing systems and protocols
Non- linear- nonlinear development of code
Branching – easy to create and merge branches
Lightweight – lossless compression
Speed- faster than remote repository
Reliable – not viable to loss of data upon crashes
Secure – SHA1 and checksum are used
Economical – free
GIT operations and commands:
Initial config of username, email and code highlighting (optional) is to be performed.
$GIT config — global user.name”firstname lastname”
$GIT config — global user.email” firstname.lastname@example.org”
$GIT config — global color.ui true (enables code highlights)
$GIT config –list
You have to initialize by using ‘init’
To know the status run the ‘status’ command
To add a file:
To add multiple files
$GIT add<filename> <2nd filename> <3rd filename>
To add all updated files
$GIT add –all ( use -A instead of -all too )
To remove files
$GIT rm -r <filename>
To pass a message, use ‘commit’ and ‘-m’
$GIT commit -m “body_of_message”
Amend lets you amend the last commit or the last message
$GIT commit –amend -m “new_message”
Push and Pull
A remote repository typically represents a remote server or a GIT server.
Create a remote repository via GIThub “https://GIThub.com/YourUsername/appname.GIT”