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


Popular posts from this blog

Another instance of Certbot is already running - Solved - Linux guru

Install Apache Using Ansible Playbooks

1 node(s) had taints that the pod didn't tolerate Solved

Setup password less SSH on linux

Manage GCP bucket using gsutil command