Professional Documents
Culture Documents
F A
A
WHY GIT?
S T
M U
IT IS USED FOR SOURCE CODE MANAGEMENT.
YSAME FILE.
GIT IS USED TO MAINTAIN MULTIPLE
S B
VERSIONS OF THE
O P
E V
D FILE1
10 ---> LOC
FILE1
30 ---> LOC
GIT STAGES:
WORKING DIRECTORY
A F
S T
In this stage git is only aware of having files in
the project.
M U
B Y
It will not track these files until we commit those
files.
P S
V O
E
STAGING AREA:
D staging area is like a rough draft space, it's
The
where you can git add the version of a file or
multiple files that you want to save in your next
commit.
In other words, in the next version of your project.
REPOSITORY:
A
It contains the collection of the files and also
F
TA
history of changes made to those files.
S
We have 3 repositories in GIT
MU
LOCAL REPO
B Y
P S
O
REMOTE REPO
V
DE
CENTRAL REPO
LOCAL REPO:
FA
The Local Repository is everything in your .git
TA
directory. Mainly what you will see in your Local
S
U
Repository are all of your checkpoints or commits. It
M
is the area that saves everything (so don’t delete it).
Y
S B REMOTE REPO:
OP
EV
The remote repository is a Git repository that is
CENTRAL REPO:
INSTALL GIT:
yum install git -y
yum: yellowdog updater modifier
A
git --version
git init . : to get empty repo
AF
ST
M U
To track the file:
B Y
git add file_name
git add awsO
S
P gcp: multiple files
: single file
E V azure
D * : all regular files
git add
git add . : including hidden files
GIT INSTALL: yum install git -y
F A
TO INITILIZE AN EMPTY REPO: git init .
S T A
M U
here .(dot) represents the current directory (~). so it
B Y
will creates .git folder (hidden)
P S
V O git --version
DEgit version 2.38.1
to check the version:
it returns:
B Y
red color files represents untracking file
tracking means: O P S
E V on a file.
we have a record that what we
D
made the changes
it will track the each and every change in a file.
M U
B Ygit commit -m "msg" f1 f2
P S
to commit multiple files:
to commit allO
E V tracking files: git commit -m "msg" .
D
.(dot) represents the all tracking files
notes: we can't commit the untracking files.
E V
git commit -m "message" .
D
to check the history
git log
git log:
git log -2: latest 2 commit
git log --oneline: used to see only commit id's
and commit messages
F A
A
their mail id in git
S T
command: git config user.name "user_name"
M U
git config user.email "user@email.com"
O
command: P git
V
git show:Eit is used to show the file names in log
D
command: git show commit_id --name-only