Git commands
mkdir gitone gittwo gitthree
ls
git --versiongit -v
git statuscd gitone
ls -la
git initgit statusls -la
cd .gitcd ..ls
pwdgit statustouch testone.txt testtwo.txtgit status
git add testone.txtgit status
git commit -s -m "this is my first commit"
git add testtwo.txtgit status
git commit
git loggit log --online
git config --global user.name "sandeep kumar"git config --global user.email "abc@gmail.com"git config --global core.editor "code --wait"
touch .gitignore // write in this files and folders rootstouch .env
git statusgit add .git statusgit commit //commit file opengit log --online
cdpwdcat .gitconfig
git log --onlinelsls -lacd .git/lsls -la
Video -03
cd gittwo/lsgit statusgit initgit statustouch index.htmlgit statusgit add index.htmlgit statusgit commit -m "add index file"
git branch{/* make changes in html file */}git add index.htmlgit commit -m "update code for index file"
git branch nav-bargit branchgit checkout nav-bartouch nav-bar.htmlgit statusgit add nav-bar.htmlgit commit -m "add navrbar to codebase"
git checkout mastertouch hero-section.htmlgit add hero-section.htmlgit commit -m "add hero section"
git checkout nav-bargit checkout master
git branchgit log --onelinegit checkout nav-bargit log --oneline
other commands
git branchgit branch bugfixgit switch bugfixgit loggit switch mastergit switch -c dark-modegit checkout -b pink-mode
git branchgit checkout mastergit branchgit merge nav-bargit log --onelinegit branch -d nav-bar // dangergit branch
git checkout -b footergit branchtouch footer.htmlgit add footer.htmlgit commit -s -m "add footer"git statusgit checkout mastergit branchgit merge footer// change index.htmlgit add index.htmlgit commit -s -m "footer in index file"
git checkout footer// change index.html at same line like master branchgit add index.htmlgit commit -s -m "update index file with footer"
git checkout mastergit checkout footergit checkout mastergit merge footergit add index.htmlgit commit -s -m "merge footer branch"
// Lac 06
git status//change navbar and add some codegit add index.htmlgit statusgit diffgit diff index.htmlgit diff --staged// add content in footergit diff footer.htmlgit statusgit diff --stagedgit commit -s -m "change index and footer"git log --onelinegit diff <commitId1> <commitId2>git diff <branch1name> <branch2name>git diff --onelinegit diff <commitId1> <commitId2>
git statusgit switch -c bugfixgit branch// add code in footer.htmlgit switch footergit stashgit switch footergit switch bugfixgit stash pop// add more content footer.htmlgit switch mastergit stash popgit stash listgit stash apply@{3}git log --onelinegit checkout <commitId>git log --onelinegit checkout HEADgit switch mastergit reflowgit log --onelinegit checkout HEAD~2
Lac 07
git statusgit branchgit checkout master// change on index.html codegit statusgit commit -am "updated main website"git checkout bugfix// edit bugfix index.htmlgit commit -am "updated navbar"git checkout master// change on index.html codegit commit -am "images added"git checkout bugfixgit branchgit merge master// change on index.html codegit commit -am "about us fixed"git checkout master// change on index.html codegit commit -am "pricing card added"git log --onelinegit checkout bugfixgit log --onelinegit branchgit rebase mastergit checkout bugfix// change on index.html codegit commit -am "home tab fixed"git checkout master// change on index.html codegit commit -am "why us section added"git checkout bugfix// change on index.html codegit commit -am "add card to index file"git branchgit rebase mastergit add index.htmlgit rebase --continue
Lac 07
cd gitthreegit init git statusgit commit -am "index file add"git branch -M maingit remove -vgit remote add origin https://.....git remove -vgit push -u origin main// change in index.htmlgit add index.htmlgit commit -m "list added"git pushgit add readme.mdgit commit -m "readme added"
git clone https://.....
Create fork
git clone https://...git statusgit branchgit checkout -d navfeaturetouch navbar.htmlgit add navbar.htmlgit commit -m "add navbar feature to code"git remote -vgit branchgit push origin navbar
// comare and make pull request on github// title, descriptionmake a pull requestmerge pull request