Git And Github
------------------------------------ GIT -----------------------------------------
===> Some basic Knowledge for git and github
-> by default the branch is main but u can making a new one by using the code "git branch branchName" this new brach is kind a variable that have data of main branch.
-> HEAD in git is kinda pointer in git because it usually point from main branch to other branches. by default the head is on the main, it could be represented by *, for eg -> main*
-> one pull request can only assocaiated with one branch, if u want to make another pull request then make another branch.
->
->
->
->
===> Some common commands
ls -> list all the directory
cd -> change directory
clear -> clearing the terminal of commands
mkdir fileName -> make directory
rmdir fileName -> delete directory
rm -rf fileName -> for removing the file not the folder
vi fileName -> for writing something in the file (use I for writing, ecs for go back and :x for exit)
cat fileName -> display the content inside the file
===> Git commands
git init -> initalize the git repo in the folder
git status -> for checking the changes made in the project
git add fileName or . -> for tracking the untracked files in git (either give fileName or .(all))
git commit -m "messageHere" -> for commit the changing in the server (-m means message)
git restore --staged fileName -> removing the file which is added to the by git add (going one step back)
git log -> all the changes till this point
git reset 0c3aeec794550e0d23f43fb77ed8(git commit id hai ya (iss id sa upper wala commits he remove ho ga, iss ka bad wala nhi remove hoga)) -> for removing the previous commits
git remote add origin URL -> for setting your github profile in your project folder
git push origin master(master is a branch, it could be other thing also like main) -> for pushing the commits if of the folder into the github
git branch branchName -> creating the new branch on the top of main branch
git checkout branchName -> switching the branches, like from main other master and master to main
git merge branchName -> mergining the new branch to the main branch
git clone URL -> for downloading the repo in the local storage
git stash -> send the file in background area so the it won't git commited on the of git add
Comments
Post a Comment