Basic Git Commands Linux Guru

Git Commands

image courtesy git-scm

Here are some git command list which are comes in daily use.

Creating and Cloning:

git init
create and initialize local git repository
git clone REPO_URL
Clone remore repo
git remote add origin REPO_URL
add remote repository.
git config-global my-name
set author name
git config-global my-email
set author email

Basic git commands : 

git status
check the current state of repository
git add .
Add all the files to staging area repository
git add vishal.txt
add perticular file to the staging area repository
git commit -m "commit message"
commit files
git pull
pull the latest code from repo
git pull origin remote-branch
pull the latest code from the remote branch
git push
remember branch push
git push -u origin branch_name
push code to the remote branch
git diff branch1 branch2
show different between two branches befor merge
git stash
save the work and clean the working directory
git rm -f
delete a file
git log
show the entire git log

Create branch and merging : 

git branch branch_name
create a branch
git branch
list branch in local repository
git branch -a
list all branches from remote and local
git branch -d my_branch
delete local branch
git push origin --delete my_branch
delete branch from remote repo
git checkout -b my_branch
create new branch and switch to the branch
git merge branch_name
merge branch to the current
git merge my_branch target_branch
merge branch to source to target branch

Vishal Vyas [Linux Guru]

Welcome to Linux Guru! Hello, friends. My name is Vishal Vyas, and I am a DevOps engineer with expertise in Linux and Cloud Computing. I am also a Certified Kubernetes Administrator with over 12 years of experience in the IT field, working with various technologies. Through this blog, I aim to share my technical knowledge on Linux, AWS, DevOps, and web technologies. I will be posting about what I have learned from the latest web technologies and similar topics.

Post a Comment

If you have any doubts, Please let me know

Previous Post Next Post