Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

git --> Source code management

github / gitlab / bitbucket ---> Storage (online)


-------------------------------------------------------

Source Code Mgmt (yaml , java, json, php, mysql)


/ \
CVCS DVCS [Distributed Version Control System]
(Centrelized
Version
Control System)

------------------------------------------------------

mydata/
- login.php - mahinder (Timestamp)
- login.php - bijay (Timestamp)
- login.php - manoj (Timestamp)
- login.php - dhananjay (Timestamp)

----------------------------------------------------
yum install git -y

git --version

cd /opt/

mkdir myrepo

cd /opt/myrepo

mkdir project1

cd project1

pwd
Output ---> /opt/myrepo/project1

git init

git config --global user.name "Ekam"

git config --global user.email "ekam@gmail.com"

git config --list

git status

echo "hello world" > index.html

echo "my address is" > contactus.html

git status

git commit -m "I have added few files for new project of CX ...."
git status

echo " Hello new AI world " >> index.html

git status

git add index.html

git restore index.html

echo "user1: India@123 " > password-info.txt

git add password-info.txt # Stage Area

git commit -m "My first passowrd file " # Commit area of local repo

git status

output :
---------------------
On branch master
nothing to commit, working tree clean
----------------------

rm -f password-info.txt

git add password-info.txt

git commit -m "Deleted password-info.txt"

git status
----------------------------------------------------------

how to create new branch ?


-----------------------------------
git branch feature1

git branch

git checkout feature1

OR

git checkout -b feature2


---------------------------------
git status
----------------------------------
How to list all branches of git (Local)

git branch

How to checkout in new / another branch ?

git checkout <branch-name>

git checkout feature1

git status
---------------------------------------------
How to see logs / commit with id ( To help or track files info in branches) :

git log

git log --oneline #(branch wise log info will print)

-----------------------------------------------
Download and install Git scm tool for windows :

https://git-scm.com/downloads

------------------------------------------------
cd /opt/

mkdir myrepo

cd myrepo

git clone https://github.com/cdtsbikaner/devops132024.git

ls -ltr

cd devops132024

ls -ltr

git remote -v

git pull

git fetch
---------------------------------------------

git pull vs git fetch vs git clone

git push
----------------------------------------------

You might also like