GITHUB NOTES
git status # give the status of the current directory
git initi #initiate the file into git
git add --a #stage all the changes
git commit -m "message" #stage your git file and you can give message what you done
git log #to see all the commit
git add "file name" #to add a single file in commit
rm -rf .git #to delete the git Repositories
git clone "module Url " #import the Url of Repository
ls #to get the list of your repository
#git ignore
if we want to ignore some file on git then we need to create touch .git ignore file and put any file on it our git will ignore it
if i want to ignore whole directory than i need to put *.log (or any particular file or folder i need to ignore put it in git ignore file)
git automatically ignore blank file (to ignore all the file of directories then we need to put dir/)
if i want to ignore on screen file of that particular directory than i need to put (/dir/) or what ever the name of that directory
#git diff
it compare the working directory with the staging area directory
#git diff --staged
it compare my last commit with my recent staging area
#git commit -a -m "direct commit"
this command skip the stageing area and directly commit you all the tracked file
(q) is use to exit the pager
#git rm (file name )
remove the file from your current directory and also stage the changes
#git log -p (-number): number = number of commit you want to see
tell us all the changes happen in your current repository(with all the commit happen in it)
#git --status
it will tell us what happen with the file in a short
#git log --pretty=oneline
to get all the commits in the one line (if you want to print all the commits than this command is use to)
#git log --pretty=short
than it will tell as all the things in short what the commits is happen in our code in short if we want to find the particular commit than we use
this command
#git log --pretty=full
it will tell us about all the commits in more the more defind way
it tell us about the Auther also
Auther = the person who first created the file are called Auther
committer = the person suggest to change the file are called as committer
#git log --since=2.days
it will tell us all the work happen in last 2 days and we can change the time filter according to need days or month what ever we want
#git log --pretty=format:"%h -- %an"
by this command we can get the format of our git according to the need
website (git scm usefull option for git log format) to get the more format option
#git commit --amend
to combine my commit and the another person commit and also it message
(to us the vim tab we need to press i)if we press i than we get access how to write on that tab
escape : wq (enter) commit happen
#git restore --staged (file name)
to un stage our file from he staged area
# git checkout -- (file name)(if we use (-f) it will un modify all the files)
to get the un modifyed file back and get the orignal file you not want to change it
**************** HOW TO PULL YOUR FILE ON GIT HUB *********************
remote = it is our remote Repositories present on any server and we can pull and push our code from their
open your git hub account after that we need to click on a (+) and go for new repository
it will provide us a option in which we need to give the name to our repository
and in demo we need to write what this repository denoted for(git hub is nothing it just host our remote repository)
after that go to that folder in which you are working
1.open the git bash
pull = from the server whole the code with all the commits come in your git bash
push = only the commit is pushed to the remote repository
copy the link from the website put it here it means you are adding your file in the origin name of url( git remote add origin https://github.com/deepak6210/test.git
)
after that go to the ssh and (gpg) key
click on new ssh key (ssh depend on the number of devices you have)
################HOW TO MAKE SSH KEYS###########################
copy paste this command in your git bash
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
enter enter enter.......
to check your ssh agent is working or not (eval $(ssh-agent -s)) use this command
after that we need to give this command (ssh-add ~/.ssh/id_rsa)
after that we need to run (tail ~/.ssh/id_rsa.pub)
we get that ssh key after this command and we need to to copy that ssh key and paste it to ssh key section
of your git hub
after that we need to give command ( git push -u origin master) this will push our code to the git server
#####################ALIAS###################################
it is a way to change the name of on going commands of your git bash
(git config --global alias.(new name of command) '(old command name)'
it will increase our efficiency and reduce the big commands in smaller one
###########################BRANCHING IN GIT##########################
to change the branch (git checkout -b 'the name of branch you want to give')
############TO GO BACK ON THE MASTER BRANCH##########################
(git checkout master)
to get all the branches = (git branch)
###########################TO MERGE A BRANCH############################
to merge a branch (git merge (branch name you want to merge))
################################COMMANDS######################
(git branch -d develop) delete the already existing branch if the the branch is not merged than it will show you error
and you need to replace small (d) with big (D)
(git branch --merge) = it will tell us already merged branch in our master branch
(git branch --no-merge)= it will tell us about the branch which are not merged in the master branch
(git branch -v) = tell us last commit of all the branches
(git push origin (branch name)) to give a pull request on our git always note:- always give pull request from the same branch you are pulling
(git push -d origin (branch name)) = use to delete the branch from the git hub hosted site
git initi #initiate the file into git
git add --a #stage all the changes
git commit -m "message" #stage your git file and you can give message what you done
git log #to see all the commit
git add "file name" #to add a single file in commit
rm -rf .git #to delete the git Repositories
git clone "module Url " #import the Url of Repository
ls #to get the list of your repository
#git ignore
if we want to ignore some file on git then we need to create touch .git ignore file and put any file on it our git will ignore it
if i want to ignore whole directory than i need to put *.log (or any particular file or folder i need to ignore put it in git ignore file)
git automatically ignore blank file (to ignore all the file of directories then we need to put dir/)
if i want to ignore on screen file of that particular directory than i need to put (/dir/) or what ever the name of that directory
#git diff
it compare the working directory with the staging area directory
#git diff --staged
it compare my last commit with my recent staging area
#git commit -a -m "direct commit"
this command skip the stageing area and directly commit you all the tracked file
(q) is use to exit the pager
#git rm (file name )
remove the file from your current directory and also stage the changes
#git log -p (-number): number = number of commit you want to see
tell us all the changes happen in your current repository(with all the commit happen in it)
#git --status
it will tell us what happen with the file in a short
#git log --pretty=oneline
to get all the commits in the one line (if you want to print all the commits than this command is use to)
#git log --pretty=short
than it will tell as all the things in short what the commits is happen in our code in short if we want to find the particular commit than we use
this command
#git log --pretty=full
it will tell us about all the commits in more the more defind way
it tell us about the Auther also
Auther = the person who first created the file are called Auther
committer = the person suggest to change the file are called as committer
#git log --since=2.days
it will tell us all the work happen in last 2 days and we can change the time filter according to need days or month what ever we want
#git log --pretty=format:"%h -- %an"
by this command we can get the format of our git according to the need
website (git scm usefull option for git log format) to get the more format option
#git commit --amend
to combine my commit and the another person commit and also it message
(to us the vim tab we need to press i)if we press i than we get access how to write on that tab
escape : wq (enter) commit happen
#git restore --staged (file name)
to un stage our file from he staged area
# git checkout -- (file name)(if we use (-f) it will un modify all the files)
to get the un modifyed file back and get the orignal file you not want to change it
**************** HOW TO PULL YOUR FILE ON GIT HUB *********************
remote = it is our remote Repositories present on any server and we can pull and push our code from their
open your git hub account after that we need to click on a (+) and go for new repository
it will provide us a option in which we need to give the name to our repository
and in demo we need to write what this repository denoted for(git hub is nothing it just host our remote repository)
after that go to that folder in which you are working
1.open the git bash
pull = from the server whole the code with all the commits come in your git bash
push = only the commit is pushed to the remote repository
copy the link from the website put it here it means you are adding your file in the origin name of url( git remote add origin https://github.com/deepak6210/test.git
)
after that copy this command and put it in your git bash it will host your repository to the git hub(git push -u origin master
********************FOR BEGINNER*************************
go the main setting of you git hub account after that go to the ssh and (gpg) key
click on new ssh key (ssh depend on the number of devices you have)
################HOW TO MAKE SSH KEYS###########################
copy paste this command in your git bash
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
enter enter enter.......
to check your ssh agent is working or not (eval $(ssh-agent -s)) use this command
after that we need to give this command (ssh-add ~/.ssh/id_rsa)
after that we need to run (tail ~/.ssh/id_rsa.pub)
we get that ssh key after this command and we need to to copy that ssh key and paste it to ssh key section
of your git hub
after that we need to give command ( git push -u origin master) this will push our code to the git server
#####################ALIAS###################################
it is a way to change the name of on going commands of your git bash
(git config --global alias.(new name of command) '(old command name)'
it will increase our efficiency and reduce the big commands in smaller one
###########################BRANCHING IN GIT##########################
to change the branch (git checkout -b 'the name of branch you want to give')
############TO GO BACK ON THE MASTER BRANCH##########################
(git checkout master)
to get all the branches = (git branch)
###########################TO MERGE A BRANCH############################
to merge a branch (git merge (branch name you want to merge))
################################COMMANDS######################
(git branch -d develop) delete the already existing branch if the the branch is not merged than it will show you error
and you need to replace small (d) with big (D)
(git branch --merge) = it will tell us already merged branch in our master branch
(git branch --no-merge)= it will tell us about the branch which are not merged in the master branch
(git branch -v) = tell us last commit of all the branches
(git push origin (branch name)) to give a pull request on our git always note:- always give pull request from the same branch you are pulling
(git push -d origin (branch name)) = use to delete the branch from the git hub hosted site
Comments
Post a Comment