Untitled
Untitled
-----------------------------------------------------------------------------------
-----------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------
//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
// set token(using this command insite a git base) :git remote set-url origin
https://<token>@github.com/username/HarshalGhadiya.git
// User name : HarshalGhadiya
// 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(temp token)
CODE:
// git --version
// git help (-a,--all)
// cheak current path : pwd
// change directory : d/
// create a directory : mkdir
// git branch -M main :this can will be use a set default branch master to a main.
// git branch -r :this can will be show a remote branches
// create a file inside a directory : touch index.html(file name with touch
command)
// Initialized empty Git repository in D:/projects/sampleproject/.git/ : git init
// ls (show all file in curtrent folder)
// rm <file nam> :remove file from given folder
// code . :this can will be use for open a project or fill in the vscode
// git clone (url) :this can will be clone a git project
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------
2. CHEAK & SET USERNAME AND EMAIL (this can will be show the user/project/system
level configpath configaration)
CODE : git config --list --show-origin
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------
3.git (add,status,log)
// git add (file_name) : add file working area to stagging area
// git status : cheak file status
// git init : intialiaze a repositry
// git log : showing how much time commite done (intitial + final commit)
// git add . : add all file in staging area
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------------------------------------
6.git mv and restore command (changing file name & restore file)
example: git mv h.text h.html (changed successfully)
example: git restore --staged a.html (restore stagging area to working area)
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------------------------------------
7.GIT BRANCHING
// THIS ALL COMMAND SWITCH BETWEEN A BRANCHES AND COMMITES
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------------------------------
8.GIT CHECKOUT
//git checkout master:head will be point to the master (replace master accoding to
your branch name)
//git checkout - : this can will be move a head from a previouse(means goback from
one step)
//git checkout Head~(number) :this can will be going back from give a number of
commit
//git checkout -- (filename) : this command will be use discard those file changes
//git checkout Head (filename):same work as above line ( " )
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------
//git switch (branch name) : (this commmand will be switch only between the two
branches)
//git switch -c (new branch name) :(this command will be genrate a new branch and
switch given branch name)(example : git switch -c loginbranch )
//git switch - :this can will be move from a previous branch
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------
GIT-HUB
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
----------------------------------------------------
10. Ssh key-pair between com & git hub
step-3 Add your SSH private key to the ssh-agent. If you created your key with a
different name,
or if you are adding an existing key that has a different name, replace id_ed25519
in the
command with the name of your private key file.
$ ssh-add ~/.ssh/id_ed25519
other : ssh-add ~/.ssh/id_rsa
other: cat ~/.ssh/id_rsa.pub ::=>this Comand give a Hashing Formated keys
$ ssh -T [email protected]
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------------------
11. Add, Rename & Remove Remote origin url to the Git Repo
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------------------------------------------
// git push origin master : push a code in master branch (you can add your remote
name)
// git push origin new_branch:master :(this command will be use push a code inside
of one branch to another branch)
// git push -u origin new_branch :( this can will be set a branch to a upstream
form)
// git push --set-upstream origin master :(this command also set a branch to a
upstream)
//NOTE:after set upstream branch you can directly push your code using [ git
push ] command
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------
15.SET GITHUB ALIAS GLOBALY